Documentation
¶
Overview ¶
Package mittwald implements a DNS record management client compatible with the libdns interfaces for mittwald mStudio (https://www.mittwald.de).
The mStudio API keeps the records of each name in an object of its own, which it calls a zone: a domain and every name below it (www, _acme-challenge, _dmarc) each have one, with one record set per type (A and AAAA together, CNAME, MX, TXT, SRV and CAA). These are not DNS zones: DNS has one zone per domain with one SOA, and a name below it cannot be delegated. A CNAME is therefore possible below the apex only; the API rejects one at the apex. This package creates the object of a name when a record is added to it and deletes it when its last record is removed, except for the domain's own, one with a set that mStudio manages and one with objects of names below it. A record for a name without an object takes longer until the nameservers serve it than a change for a name that has one (73 against 21 to 31 seconds, measured once in production).
A set has one TTL. Records written with a TTL give it to the whole set, the AAAA records included when A records are written and the other way round, as with libdns/hetzner; AppendRecords that adds a record therefore changes the TTL of the existing records of its set, which the libdns contract does not foresee. A TTL of 0 keeps the set's TTL; TTLs are brought into 60 seconds to one day. DeleteRecords does not compare TTLs.
Record sets that mStudio manages (the addresses of a name connected to an ingress, the mail exchangers of mittwald's mail service) are not returned by GetRecords. Writing A, AAAA or MX records to such a name replaces the managed set.
Changes are not atomic: a call that fails may have applied part of its records.
Index ¶
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) ListZones(ctx context.Context) ([]libdns.Zone, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// APIToken is an mStudio API token of a user with access to the projects
// of the domains.
APIToken string `json:"api_token,omitempty"`
// contains filtered or unexported fields
}
Provider facilitates DNS record manipulation with mittwald mStudio.
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 ¶
GetRecords lists all the records in the zone.