Documentation
¶
Index ¶
- Constants
- Variables
- func IPv6Available() bool
- func RcodeToString(rcode int) string
- func SetLogger(l log.Logger)
- func TypeToString(rrtype uint16) string
- func UpdateIPv6Availability()
- type CacheInterface
- type Config
- type NameserverPoolStatus
- type Option
- func WithCache(size int) Option
- func WithClient(client string, fallback bool) Option
- func WithCustomRoot(filename string, anchorfilename string) Option
- func WithDNSPort(dnsPort int) Option
- func WithDesireNumberOfNameserversPerZone(n int) Option
- func WithDoQPort(doqPort int) Option
- func WithDoTPort(dotPort int) Option
- func WithLazyEnrichment(lazy bool) Option
- func WithLogger(l log.Logger) Option
- func WithMaxAllowedTTL(ttl uint32) Option
- func WithMaxQueriesPerRequest(max uint32) Option
- func WithPQCMode(pqcMode bool) Option
- func WithRemoveAdditionalSectionForPositiveAnswers(remove bool) Option
- func WithRemoveAuthoritySectionForPositiveAnswers(remove bool) Option
- func WithSuppressBogusResponseSections(suppress bool) Option
- func WithTLSCache(capacity int) Option
- func WithTLSVerification(verify bool) Option
- func WithTimeouts(udp, tcp, tls, quic time.Duration) Option
- func WithTrustAnchors(anchors []*dns.DS) Option
- func WithUDPSize(udpsize uint16) Option
- type Resolver
- type Response
- type Trace
Constants ¶
const ( DefaultMaxAllowedTTL = uint32(60 * 60 * 48) // 48 Hours DefaultMaxQueriesPerRequest = uint32(100) DefaultDesireNumberOfNameserversPerZone = 3 DefaultLazyEnrichment = false DefaultSuppressBogusResponseSections = true DefaultRemoveAuthoritySectionForPositiveAnswers = true DefaultRemoveAdditionalSectionForPositiveAnswers = true DefaultUDPSize uint16 = 8192 DefaultTimeoutUDP = 400 * time.Millisecond DefaultTimeoutTCP = 1000 * time.Millisecond DefaultTimeoutDOQ = 600 * time.Millisecond DefaultTimeoutDOT = 1500 * time.Millisecond DefaultDNSPort = "53" DefaultDoQPort = "853" DefaultDoTPort = "8853" DefaultRootzone = "named.root" DefaultRootanchors = "root-anchors.xml" // just some random values. no real thought went into this. DefaultTLSCacheSize = 1024 DefaultCacheSize = 2048 )
const (
CtxTrace ctxKey = iota
)
Variables ¶
var ( ErrNotRecursionDesired = errors.New("only recursive queries are supported via this server") ErrNilMessageSentToExchange = errors.New("nil message sent to exchange") ErrNoPoolConfiguredForZone = errors.New("no nameserver pool configured for zone") ErrFailedToGetDNSKEYs = errors.New("failed looking up DNSKEY records") ErrFailedCreatingZoneAndPool = errors.New("failed creating nameserver pool for zone") ErrFailedEnrichingPool = errors.New("failed enriching nameserver pool for zone") ErrUnableToResolveAnswer = errors.New("failed resolving answer") ErrNextNameserversNotFound = errors.New("the onward nameservers cannot be found") ErrEmptyResponse = errors.New("the received response is empty") ErrInternalError = errors.New("internal error") ErrMaxQueriesPerRequestReached = errors.New("max queries per request reached") )
var DefaultConfig = Config{ // contains filtered or unexported fields }
DefaultConfig is a working default configuration.
var Log log.Logger = log.NopLogger{}
Log is the package-level default logger. It defaults to doing nothing.
Functions ¶
func IPv6Available ¶
func IPv6Available() bool
IPv6Available return true if IPv6 Internet connectivity is found. If the check has not been performed, it won't block, and (initially) will return false.
func RcodeToString ¶
func SetLogger ¶ added in v1.0.4
SetLogger allows external users to override the package-level default logger. It only affects Configs built afterwards (see ConfigBuilder).
func TypeToString ¶
func UpdateIPv6Availability ¶
func UpdateIPv6Availability()
UpdateIPv6Availability sense checks if we can get a DNS response from an IPv6 address.
Types ¶
type CacheInterface ¶
type CacheInterface interface {
Get(qmsg *dns.Msg) (*dns.Msg, error)
// Update inserts msg into the cache with the validation status that was
// determined for it (Indeterminate when no validation was performed).
// It is called once, after validation. A Bogus status evicts any existing
// entries instead of caching: bogus data must never be served.
Update(question dns.Question, msg *dns.Msg, status cache.ValidationStatus) error
}
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func ConfigBuilder ¶
ConfigBuilder builds a configuration based on the provided options. The package-level default variables are snapshotted here; later changes to them do not affect the returned Config.
type NameserverPoolStatus ¶
type NameserverPoolStatus uint8
const ( PoolEmpty NameserverPoolStatus = iota PoolExpired PoolHasHostnamesButNoIpAddresses PrimedButNeedsEnhancing PoolPrimed )
type Option ¶
type Option func(*Config)
func WithCache ¶ added in v0.2.0
WithCache sets the DNS cache. If set to 0, it gets disabled. Note: this is the DNS cache, not the TLS session cache.
func WithClient ¶
WithClients specifies which client to use. Supported: doq, doh, dot, udp, and tcp. Fallback can be enabled.
func WithCustomRoot ¶
WithCustomRoot overwrites the standard rootzone and anchors.
func WithDNSPort ¶ added in v0.1.5
WithCustomDNSPort changes the default port for UDP/TCP.
func WithDesireNumberOfNameserversPerZone ¶ added in v1.0.8
WithDesireNumberOfNameserversPerZone sets how many nameserver addresses a zone pool should try to know.
func WithDoQPort ¶ added in v0.1.5
WithCustomDoQPort changes the default port for DoQ.
func WithDoTPort ¶ added in v0.1.5
WithCustomDoTPort changes the default port for DoT.
func WithLazyEnrichment ¶ added in v1.0.8
WithLazyEnrichment toggles lazy pool enrichment for this instance.
func WithLogger ¶ added in v1.0.8
WithLogger sets the logger for this instance.
func WithMaxAllowedTTL ¶ added in v1.0.8
WithMaxAllowedTTL sets the maximum TTL cached for any record.
func WithMaxQueriesPerRequest ¶ added in v1.0.8
WithMaxQueriesPerRequest sets the maximum number of DNS lookups per Exchange call.
func WithPQCMode ¶ added in v0.1.4
WithPQCMode turns the pqc mode on or off.
func WithRemoveAdditionalSectionForPositiveAnswers ¶ added in v1.0.8
WithRemoveAdditionalSectionForPositiveAnswers toggles removal of the Additional section for positive answers.
func WithRemoveAuthoritySectionForPositiveAnswers ¶ added in v1.0.8
WithRemoveAuthoritySectionForPositiveAnswers toggles removal of the Authority section for positive answers.
func WithSuppressBogusResponseSections ¶ added in v1.0.8
WithSuppressBogusResponseSections toggles suppression of response sections for Bogus answers.
func WithTLSCache ¶ added in v0.1.4
WithTLSCache indicates the cache size.
func WithTLSVerification ¶
WithTLSVerification indicates if TLS verification is enabled. In case of clients that don't use TLS, this option is ignored.
func WithTimeouts ¶
WithTimeouts sets the timeouts for connections.
func WithTrustAnchors ¶ added in v1.0.8
WithTrustAnchors sets the DNSSEC trust anchors for this instance.
func WithUDPSize ¶ added in v0.1.5
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func (*Resolver) CountZones ¶
CountZones metrics gathering.