This commit is contained in:
parent
0c1b4738cd
commit
fde6624777
11
resolver.go
11
resolver.go
@ -45,11 +45,18 @@ func (r *Resolver) Lookup(net string, req *dns.Msg) (message *dns.Msg, err error
|
|||||||
logger.Warn("error:%s", err.Error())
|
logger.Warn("error:%s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// If SERVFAIL happen, should return immediately and try another upstream resolver.
|
||||||
|
// However, other Error code like NXDOMAIN is an clear response stating
|
||||||
|
// that it has been verified no such domain existas and ask other resolvers
|
||||||
|
// would make no sense. See more about #20
|
||||||
if r != nil && r.Rcode != dns.RcodeSuccess {
|
if r != nil && r.Rcode != dns.RcodeSuccess {
|
||||||
logger.Warn("%s failed to get an valid answer on %s", qname, nameserver)
|
logger.Warn("%s failed to get an valid answer on %s", qname, nameserver)
|
||||||
return
|
if r.Rcode == dns.RcodeServerFailure {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.Debug("%s resolv on %s (%s) ttl: %d", UnFqdn(qname), nameserver, net, rtt)
|
||||||
}
|
}
|
||||||
logger.Debug("%s resolv on %s (%s) ttl: %d", UnFqdn(qname), nameserver, net, rtt)
|
|
||||||
select {
|
select {
|
||||||
case res <- r:
|
case res <- r:
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user