Description
The net.Resolver
struct has the following TODOs:
// A Resolver looks up names and numbers.
//
// A nil *Resolver is equivalent to a zero Resolver.
type Resolver struct {
// PreferGo controls whether Go's built-in DNS resolver is preferred
// on platforms where it's available. It is equivalent to setting
// GODEBUG=netdns=go, but scoped to just this resolver.
PreferGo bool
// TODO(bradfitz): optional interface impl override hook
// TODO(bradfitz): Timeout time.Duration?
}
I'm interested in overriding the implementation. Specifically, I'd like to write a lookup function that ignores TTL's/returns the last good IP addresses if the DNS provider times out or returns an error instead of returning valid IP addresses. In theory that would help reliability during outages like Dyn's, where many sites were probably still available at their last known IP addresses, but the DNS resolver returned no responses for those sites.
I could override the DialContext currently, but that feels like overriding too much.
I'm happy to suggest ideas for an interface but I haven't done a ton of work with DNS and don't trust my instincts too much. @bradfitz, do you have ideas for the interface? I checked the commit and Github issues and couldn't find anything.