Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net: rename Resolver.Dial to Resolver.DialContext before Go1.9rc1? #19910
CL 37260 proposes add a new field to net.Resolver:
Elevating that CL to a proposal, hopefully a quick one.
This would allow control over the source address for DNS lookups in multi-homed systems (#17404).
Discussion on #19268 suggests that the new Dial field would be an acceptable solution for "do DNS lookups using a custom server", by installing a Dial func that lies about what server it has connected to. Of course that only works if /etc/resolv.conf lists some name server. If there are no resolvers then Dial will never be called. This particular use seems a bit kludgy, but fine if it resolves that need.
Allow the Resolver.Dial func to return instances of Conn other than *TCPConn and *UDPConn. If the Conn is also a PacketConn, assume DNS messages transmitted over the Conn adhere to section 4.2.1. "UDP usage". Otherwise, follow section 4.2.2. "TCP usage". Provides a hook mechanism so that DNS queries generated by the net package may be answered or modified before being sent to over the network. Updates #19910 Change-Id: Ib089a28ad4a1848bbeaf624ae889f1e82d56655b Reviewed-on: https://go-review.googlesource.com/45153 Run-TryBot: Brad Fitzpatrick <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Brad Fitzpatrick <email@example.com>
@bradfitz and @rsc, @benburkert raises a great point that it seems like @nerdatmath's CL https://go-review.googlesource.com/c/37260/8/src/net/lookup.go#106 already added the proposed field and perhaps we just need to rename it to DialContext?
Also by superficially skimming through the issue, I think after that rename, we'd have addressed @bradfitz's request in #19910 (comment) and then the issue can be marked as resolved. What do y'all think?