check / check (push) Waiting to run
When none of the nameservers of a hostname's zone answered, the walk to them failed and the check was only logged. The walk now returns a NoAnswerError naming the nameservers of the zone it reached through a referral when none of them answers. When those are the nameservers the previous check saved for the name, each is saved as failed with the reason, so it gets an NS Failure and later an NS Recovery. A domain with no delegation of its own, whose NS lookup is that same walk, gets the same. A walk that fails before that zone, as when the host loses its network, is still only logged. Model: opus-5-5
74 lines
2.3 KiB
Go
74 lines
2.3 KiB
Go
package resolver
|
|
|
|
import "errors"
|
|
|
|
// NoAnswerError is returned when the walk to a name's nameservers
|
|
// reached a zone through a referral and none of that zone's
|
|
// nameservers, Nameservers as the referral names them, answered. Err
|
|
// says why they did not.
|
|
type NoAnswerError struct {
|
|
Nameservers []string
|
|
Err error
|
|
}
|
|
|
|
func (e *NoAnswerError) Error() string {
|
|
return e.Err.Error()
|
|
}
|
|
|
|
func (e *NoAnswerError) Unwrap() error {
|
|
return e.Err
|
|
}
|
|
|
|
// Sentinel errors returned by the resolver.
|
|
var (
|
|
// ErrNoNameservers is returned when no authoritative NS
|
|
// could be discovered for a domain.
|
|
ErrNoNameservers = errors.New(
|
|
"no authoritative nameservers found",
|
|
)
|
|
|
|
// ErrNXDomain is returned when the servers of the zone a domain
|
|
// is in answer NXDOMAIN: the domain does not exist.
|
|
ErrNXDomain = errors.New("domain does not exist")
|
|
|
|
// ErrNoNameserverAnswered is returned when every nameserver
|
|
// asked about a name timed out, failed or returned a referral,
|
|
// so whether the name has addresses is unknown.
|
|
ErrNoNameserverAnswered = errors.New("no nameserver answered")
|
|
|
|
// ErrUnusableReply is returned when a server replied with an
|
|
// error such as SERVFAIL, or with a referral that leads no
|
|
// closer to the name asked about.
|
|
ErrUnusableReply = errors.New(
|
|
"reply is an error or a referral that leads no closer",
|
|
)
|
|
|
|
// ErrTruncated is the reason given for a reply too large for UDP
|
|
// whose retry over TCP failed.
|
|
ErrTruncated = errors.New(
|
|
"reply truncated and its retry over TCP failed",
|
|
)
|
|
|
|
// ErrIntercepted is returned when every root server refused a
|
|
// query. Root servers refuse no query, so the refusals came from
|
|
// something on the network answering in their place.
|
|
ErrIntercepted = errors.New("this network intercepts DNS queries")
|
|
|
|
// ErrCNAMEDepthExceeded is returned when a CNAME chain
|
|
// exceeds MaxCNAMEDepth.
|
|
ErrCNAMEDepthExceeded = errors.New(
|
|
"CNAME chain depth exceeded",
|
|
)
|
|
|
|
// ErrLookupDepthExceeded is returned when nameserver addresses
|
|
// were not looked up because lookups were already maxLookupDepth
|
|
// deep, one inside another.
|
|
ErrLookupDepthExceeded = errors.New(
|
|
"lookups of nameserver addresses go too deep",
|
|
)
|
|
|
|
// ErrContextCanceled wraps context cancellation for the
|
|
// resolver's iterative queries.
|
|
ErrContextCanceled = errors.New("context canceled")
|
|
)
|