tecnocratica

package module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 11 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Tecnocratica for libdns

Go Reference

This package implements the libdns interfaces for Tecnocratica, Neodigit and Virtualname, allowing you to manage DNS records.

This package uses the API at these places:

Configuration

To configure, you need to get an API Token from your control panel. Also depending on the control panel you're using, you may need to change the url

Neodigit:

Virtualname:

Example

package main

import (
    "context"
    "fmt"

    "github.com/libdns/tecnocratica"
)

func main() {
    provider := &tecnocratica.Provider{
        APIToken: "<API Token>",
        APIURL: "<The url of the control panel API>",
    }
    zone := "example.com."

    records, err := provider.GetRecords(context.TODO(), zone)

    if err != nil {
        fmt.Printf("Error: %s", err.Error())
        return
    }

    fmt.Println(records)
}

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://api.neodigit.net/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is a Neodigit API client.

type Provider

type Provider struct {
	// The neodigit/virtualname api token.
	APIToken string `json:"api_token,omitempty"`
	APIURL   string `json:"api_url,omitempty"`
}

Provider implements DNS record manipulation with neodigit/virtualname.

func (*Provider) AppendRecords

func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

AppendRecords adds records to the zone. It returns the records that were added.

func (*Provider) DeleteRecords

func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

DeleteRecords deletes the specified records from the zone. It returns the records that were deleted.

func (*Provider) GetRecords

func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)

GetRecords lists all the records in the zone.

func (*Provider) SetRecords

func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)

SetRecords sets the records in the zone, either by updating existing records or creating new ones. Per libdns spec: for any (name, type) pair in the input, SetRecords ensures that the only records in the output zone with that (name, type) pair are those provided in the input. It returns the records which were set.

type Record

type Record struct {
	ID       int    `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Type     string `json:"type,omitempty"`
	Content  string `json:"content,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
	Priority int    `json:"prio,omitempty"`
}

Record represents a DNS record.

type RecordRequest

type RecordRequest struct {
	Record Record `json:"record"`
}

RecordRequest is the request body for creating/updating a record.

type Zone

type Zone struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	HumanName string `json:"human_name"`
}

Zone represents a DNS zone.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址