enum

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 11 Imported by: 0

README

enum for libdns

Go Reference

This package implements the libdns interfaces for enum DNS, allowing you to manage DNS records.

Configuration

Field JSON Description
APIKey api_key API key of a service account with access to the project
ProjectID project_id ID of the project that owns the zones, e.g. proj-01kmyy3t719crcnrrvk1mgyjd0

Create a service account and an API key with enumctl or in the enum console.

Example

provider := enum.Provider{
	APIKey:    os.Getenv("ENUM_API_KEY"),
	ProjectID: os.Getenv("ENUM_PROJECT_ID"),
}

records, err := provider.AppendRecords(ctx, "example.com.", []libdns.Record{
	libdns.TXT{Name: "_acme-challenge", Text: "token"},
})

Caveats

  • Supported record types: A, AAAA, CAA, CNAME, MX, NS, SRV and TXT.
  • enum stores records as record sets (name, type) with one TTL. AppendRecords keeps the TTL of an existing set. SetRecords uses the TTL of the first record of each set.
  • A TTL of 0 uses the per-type default (300s for A and AAAA, 86400s for NS, 3600s otherwise). Other TTLs must be at least 60s, or 3600s for NS.
  • The apex NS records are managed by enum and cannot be changed.

Testing

See libdnstest to run the libdns test suite against your own zone.

Documentation

Overview

Package enum implements a DNS record management client compatible with the libdns interfaces for enum.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// APIKey of a service account.
	APIKey string `json:"api_key,omitempty"`

	ProjectID string `json:"project_id,omitempty"`
	// contains filtered or unexported fields
}

Provider facilitates DNS record manipulation with enum.

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. It keeps the TTL of an existing record set.

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) ListZones

func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)

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. It returns the updated records. It uses the TTL of the first record of each record set. Each record set is replaced atomically, the call as a whole is not.

Jump to

Keyboard shortcuts

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