dns

package
v1.10.21 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Overview

Package dns abstracts a managed DNS host behind one small Provider interface, backed by libdns modules. It mirrors the blob.Store pattern: adding a host later is a new case in Build, not a new client. Miabi manages only the records it owns — never a user's other records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials map[string]string

Credentials is a provider's credential blob, keyed by the field names its dnscatalog descriptor declares. Wire-compatible with the flat struct it replaced.

type Provider

type Provider interface {
	// GetRecords lists the records in a zone (used by test + conflict checks).
	GetRecords(ctx context.Context, zone string) ([]Record, error)
	// SetRecord upserts a record (creates or replaces the RRset for name+type).
	SetRecord(ctx context.Context, zone string, rec Record) error
	// DeleteRecord removes a record.
	DeleteRecord(ctx context.Context, zone string, rec Record) error
	// Test validates the credentials against a zone (a successful GetRecords).
	Test(ctx context.Context, zone string) error
}

Provider is Miabi's view of a DNS host. Implementations are idempotent and safe for concurrent use (libdns guarantees the latter).

func Build

func Build(providerType string, creds Credentials) (Provider, error)

Build returns a Provider for a connection type + its (already-decrypted) credentials. Required fields are validated against the catalog before the per-type constructor runs.

type Record

type Record struct {
	Type  string        `json:"type"`  // TXT | A | AAAA | CNAME
	Name  string        `json:"name"`  // FQDN, e.g. _miabi-challenge.example.com
	Value string        `json:"value"` // record data
	TTL   time.Duration `json:"-"`     // 0 = provider default
}

Record is Miabi's provider-agnostic view of a DNS record. Name is a FQDN (the adapter relativizes it to the zone); Value is the record data (TXT text, A/AAAA IP, CNAME target).

Jump to

Keyboard shortcuts

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