Documentation
¶
Overview ¶
Package dns provides DNS-related utilities, including DNS-over-HTTPS and IP reverse lookups.
Index ¶
Constants ¶
const DefaultTTL uint32 = 60
DefaultTTL is the DNS TTL used when a record does not specify one.
Variables ¶
This section is empty.
Functions ¶
func BlocklistLookupAddr ¶
BlocklistLookupAddr checks if the given IP address is listed in the Spamhaus blocklist.
Types ¶
type DNSRecord ¶ added in v0.63.0
type DNSRecord interface {
// RecordPrefix returns the DNS owner label prefix relative to the base domain,
// e.g. "_dmarc." or "" for the apex.
RecordPrefix() string
// RecordType returns the DNS record type string, e.g. "TXT" or "MX".
RecordType() string
// RecordValue returns the wire-ready record value for insertion into a
// CoreDNS template answer line.
RecordValue() string
}
DNSRecord is the canonical interface for DNS record types across this module. Existing smtp sub-package records implement it by structural compatibility; the coredns package imports this definition rather than defining its own.
type DOHClient ¶
DOHClient describes a DNS over HTTPS client.
func NewDOHClient ¶
NewDOHClient creates a new DNS over HTTPS client with the provided URL.
type TXTRecord ¶ added in v0.63.0
type TXTRecord struct {
// Name is the DNS owner label relative to the base domain. "" = apex.
Name string `mapstructure:"name" json:"name,omitempty"`
// Value is a Go template string for the TXT record content (e.g. "v=spf1 {{.OutboundIPList}} -all").
Value string `mapstructure:"value" json:"value"`
// TTL is the DNS TTL in seconds advertised to resolvers. Zero uses DefaultTTL.
TTL uint32 `mapstructure:"ttl" json:"ttl,omitempty"`
}
TXTRecord is a generic DNS TXT record with optional Go template expansion in Value.
func (*TXTRecord) RecordPrefix ¶ added in v0.63.0
func (*TXTRecord) RecordTTL ¶ added in v0.63.0
RecordTTL returns the TTL to use for this record, falling back to DefaultTTL.
func (*TXTRecord) RecordType ¶ added in v0.63.0
func (*TXTRecord) RecordValue ¶ added in v0.63.0
type TemplatedRecord ¶ added in v0.63.0
TemplatedRecord is satisfied by records whose field values contain Go template strings that must be expanded before the record is served. It matches the interface already defined in github.com/dioad/net/smtp.