Documentation
¶
Overview ¶
Package dns abstracts a managed DNS host behind one small Provider interface, backed by libdns modules (Cloudflare, Route 53, DigitalOcean). It mirrors the blob.Store pattern: adding a host later is a new case in Build, not a new client. Miabi uses it to manage only the records it owns (ownership TXT, app A/AAAA) — 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 struct {
APIToken string `json:"api_token,omitempty"` // cloudflare, digitalocean
AccessKeyID string `json:"access_key_id,omitempty"` // route53
SecretAccessKey string `json:"secret_access_key,omitempty"` // route53
Region string `json:"region,omitempty"` // route53
}
Credentials is the union of fields across provider types, parsed from the decrypted JSON blob. Only the fields relevant to a given Type are set.
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).
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).