Documentation
¶
Overview ¶
Package dnsinspect asks DNS questions the control plane controls itself: public resolvers and the zone's authoritative servers, so a stale cache on this host never decides whether a domain is ready.
Index ¶
Constants ¶
const ( ProviderCloudflare = "cloudflare" ProviderRoute53 = "route53" ProviderOther = "other" ProviderUnknown = "unknown" )
Name server provider classes reported by ProviderOf.
const EnvPublicResolvers = "APP_DNS_PUBLIC_RESOLVERS"
EnvPublicResolvers overrides the public resolver list (comma separated host or host:port); "off", "false" or "0" disables public queries.
const LocalName = "this server"
LocalName labels this host's own resolver in reports.
Variables ¶
This section is empty.
Functions ¶
func FlushCommand ¶
func FlushCommand() string
FlushCommand is the one-line command that clears this host's resolver cache, or empty when the resolver is not one we can name. It is shown to the operator, never run.
func ProviderOf ¶
ProviderOf classifies a zone by its name server hostnames so the UI can offer to connect the matching DNS provider. Mixed sets count as other.
func PublicResolvers ¶
func PublicResolvers() []string
PublicResolvers returns the configured public resolver addresses (host:port).
Types ¶
type Exchanger ¶
type Exchanger func(ctx context.Context, server, name string, qtype uint16, recurse bool) (*dns.Msg, error)
Exchanger sends one query; tests replace it.
type Inspection ¶
type Inspection struct {
Zone string `json:"zone,omitempty"`
// DelegatedNS is what public resolvers say the zone's name servers are;
// ZoneNS is what the zone's own servers say.
DelegatedNS []string `json:"delegated_ns,omitempty"`
ZoneNS []string `json:"zone_ns,omitempty"`
Authoritative []Source `json:"authoritative"`
Public []Source `json:"public"`
// AuthReachable is true when at least one authoritative server answered.
AuthReachable bool `json:"auth_reachable"`
// NegativeTTL is the SOA negative-caching time of the zone, in seconds.
NegativeTTL uint32 `json:"negative_ttl,omitempty"`
}
Inspection is everything one run learned.
type Inspector ¶
type Inspector struct {
Public []string
// LocalServers overrides the resolvers read from resolv.conf (tests).
LocalServers []string
// AuthPort is the port authoritative servers are queried on; 0 means 53.
AuthPort int
// AllowPrivate lets authoritative servers sit on private addresses; only
// tests set it, since otherwise a zone could aim this host at its LAN.
AllowPrivate bool
Timeout time.Duration
Exchange Exchanger
}
Inspector queries public resolvers and authoritative servers.
type Source ¶
type Source struct {
Name string `json:"name"`
Addresses []string `json:"addresses,omitempty"`
// TTL is the longest answer TTL in seconds; for an empty answer it is the
// negative-caching TTL the server reported.
TTL uint32 `json:"ttl,omitempty"`
Error string `json:"error,omitempty"`
}
Source is one resolver's answer for the domain.