net: rename Resolver.Dial to Resolver.DialContext before Go1.9rc1? #19910
Comments
I'm fine with this. But should it be named DialContext to be consistent with:
? /cc @nerdatmath |
SGTM. |
CL 37260 added this method as |
CL https://golang.org/cl/45153 mentions this issue. |
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 <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@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? |
I think |
But I could see the consistency argument too. We're days away from an rc1, though, so it's a bit late (but still possible) to change. |
I think |
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.
/cc @bradfitz
The text was updated successfully, but these errors were encountered: