Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net: ability to replace Resolver impl #17554
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.
I see there's
It is a concrete type and not an interface on purpose. That lets us extend it with options, like we have with Dialer.
The TODO is about adding an interface or bag of funcs to the Resolver to call first, before the default implementation.
But I'd like to push that off until Go 1.9.
FWIW, I tried working on an implementation of this that would let people override a
// runtimeNano returns the current value of the runtime clock in nanoseconds.