Documentation
¶
Index ¶
- func BootstrapZone(ctx context.Context, client *PowerDNSClient, dnsCfg config.DNSConfig, ...) error
- type CNAMEResolver
- type DNSCNAMEResolver
- type ErrTXTMismatch
- type PowerDNSClient
- func (c *PowerDNSClient) CreateZone(ctx context.Context, zone, baseDomain, primaryNS string, nameservers []string, ...) error
- func (c *PowerDNSClient) DeleteARecords(ctx context.Context, zone, name string) error
- func (c *PowerDNSClient) DeleteTXTRecord(ctx context.Context, zone, name string) error
- func (c *PowerDNSClient) GetZone(ctx context.Context, zone string) (bool, error)
- func (c *PowerDNSClient) Healthy(ctx context.Context) error
- func (c *PowerDNSClient) SetARecords(ctx context.Context, zone, name string, ips []string, ttl int) error
- func (c *PowerDNSClient) SetRelayRecords(ctx context.Context, zone, name string, ipv4, ipv6 []string, ttl int) error
- func (c *PowerDNSClient) SetTXTRecord(ctx context.Context, zone, name, value string, ttl int) error
- func (c *PowerDNSClient) SetTXTRecords(ctx context.Context, zone, name string, values []string, ttl int) error
- type Proxy
- type RRSet
- type Record
- type TXTVerifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootstrapZone ¶ added in v0.1.3
func BootstrapZone(ctx context.Context, client *PowerDNSClient, dnsCfg config.DNSConfig, publicHostname string, logger *slog.Logger) error
BootstrapZone ensures the DNS zone exists in PowerDNS, creating it if necessary. Retries with exponential backoff since PowerDNS may not be ready yet.
Types ¶
type CNAMEResolver ¶ added in v0.1.1
CNAMEResolver resolves CNAME records for a given domain.
type DNSCNAMEResolver ¶ added in v0.1.1
type DNSCNAMEResolver struct {
// contains filtered or unexported fields
}
DNSCNAMEResolver queries CNAME records directly using miekg/dns.
func NewDNSCNAMEResolver ¶ added in v0.1.1
func NewDNSCNAMEResolver(resolver string, timeout time.Duration) *DNSCNAMEResolver
NewDNSCNAMEResolver creates a CNAME resolver. If resolver is empty, it reads the system's /etc/resolv.conf to determine the default DNS server.
type ErrTXTMismatch ¶ added in v0.1.7
ErrTXTMismatch indicates the TXT record exists but its content does not match.
func (*ErrTXTMismatch) Error ¶ added in v0.1.7
func (e *ErrTXTMismatch) Error() string
type PowerDNSClient ¶
type PowerDNSClient struct {
// contains filtered or unexported fields
}
func NewPowerDNSClient ¶
func NewPowerDNSClient(cfg config.PowerDNSConfig, logger *slog.Logger) *PowerDNSClient
func (*PowerDNSClient) CreateZone ¶ added in v0.1.3
func (c *PowerDNSClient) CreateZone(ctx context.Context, zone, baseDomain, primaryNS string, nameservers []string, relayHostname string) error
CreateZone creates a new zone with SOA, NS, and wildcard CNAME records. primaryNS is the SOA MNAME (the zone master / hidden primary). nameservers are the NS records that resolvers use (may differ from primaryNS in hidden-primary mode). Returns nil if the zone already exists (409 Conflict).
func (*PowerDNSClient) DeleteARecords ¶
func (c *PowerDNSClient) DeleteARecords(ctx context.Context, zone, name string) error
DeleteARecords removes all A records for a name.
func (*PowerDNSClient) DeleteTXTRecord ¶
func (c *PowerDNSClient) DeleteTXTRecord(ctx context.Context, zone, name string) error
DeleteTXTRecord removes a TXT record.
func (*PowerDNSClient) GetZone ¶ added in v0.1.3
GetZone checks if a zone exists in PowerDNS. Returns true if it exists.
func (*PowerDNSClient) Healthy ¶
func (c *PowerDNSClient) Healthy(ctx context.Context) error
Healthy checks if the PowerDNS API is reachable.
func (*PowerDNSClient) SetARecords ¶
func (c *PowerDNSClient) SetARecords(ctx context.Context, zone, name string, ips []string, ttl int) error
SetARecords replaces all A records for a name with the given IPs.
func (*PowerDNSClient) SetRelayRecords ¶
func (c *PowerDNSClient) SetRelayRecords(ctx context.Context, zone, name string, ipv4, ipv6 []string, ttl int) error
SetRelayRecords atomically replaces A and AAAA records for the relay hostname. Empty slices cause the corresponding record type to be deleted.
func (*PowerDNSClient) SetTXTRecord ¶
SetTXTRecord creates or replaces a single TXT record.
func (*PowerDNSClient) SetTXTRecords ¶ added in v0.1.7
func (c *PowerDNSClient) SetTXTRecords(ctx context.Context, zone, name string, values []string, ttl int) error
SetTXTRecords creates or replaces all TXT records for a name. Each value becomes a separate record in the RRSet. Use DeleteTXTRecord to remove all records; passing an empty values slice is an error.
type Proxy ¶ added in v0.1.3
type Proxy struct {
// contains filtered or unexported fields
}
Proxy forwards DNS traffic from a listen address to an upstream address.
func NewProxy ¶ added in v0.1.3
NewProxy creates a DNS proxy that forwards traffic from listenAddr to upstreamAddr.
type RRSet ¶
type RRSet struct {
Name string `json:"name"`
Type string `json:"type"`
TTL int `json:"ttl"`
ChangeType string `json:"changetype"`
Records []Record `json:"records"`
}
RRSet represents a PowerDNS resource record set.
type TXTVerifier ¶ added in v0.1.7
type TXTVerifier struct {
// contains filtered or unexported fields
}
TXTVerifier queries an authoritative DNS server to verify TXT record content. Used as a write-back correctness check after setting records via the PowerDNS API.
func NewTXTVerifier ¶ added in v0.1.7
func NewTXTVerifier(dnsAddress string, queryTimeout time.Duration) *TXTVerifier
NewTXTVerifier creates a verifier that queries the given DNS address. The address must be the authoritative PowerDNS DNS listener (not a recursive resolver).
func (*TXTVerifier) VerifyTXT ¶ added in v0.1.7
func (v *TXTVerifier) VerifyTXT(ctx context.Context, fqdn, expectedValue string) error
VerifyTXT sends a TXT query to the authoritative server and checks that the response contains expectedValue. Returns nil on match, *ErrTXTMismatch on content mismatch, or a wrapped error on query failure.