Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: there should be a net.ResolveAddr() function #5133

Closed
siebenmann opened this issue Mar 26, 2013 · 8 comments

Comments

Projects
None yet
6 participants
@siebenmann
Copy link

commented Mar 26, 2013

Now that there is net.DialOpt() and net.LocalAddress(), it would be quite
convenient to have a net.ResolveAddr() function so that you can generically
create the local address Addr that net.LocalAddress() wants. Right now
you have to write code that switches on the network type to call the
appropriate Resolve<whatever>Addr() function; among other issues, this
burns knowledge of what network types the net package supports into your
own code.

Basically all of the code necessary already exists in the internal
net resolveAddr() function; all that would be necessary would be
exposing a public interface to it.
@davecheney

This comment has been minimized.

Copy link
Contributor

commented May 25, 2013

Comment 1:

mikio / rsc - do you think that it is appropriate to add this function to the net
package in the 1.2 cycle ?

Status changed to Thinking.

@mikioh

This comment has been minimized.

Copy link
Contributor

commented May 31, 2013

Comment 2:

I think API surface is fine but I'm afraid this API will have the same issue which
existing ResolveProtocolAddr API has, that is that how could we select an appropriate
address for any purposes without any preferences such as a target/destination address,
routing information, etc when the user passes a DNS reg. name instead of a literal IP
address.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2013

Comment 3:

I can't make sense of this report: I don't see a net.DialOpt or a net.LocalAddress.
@siebenmann

This comment has been minimized.

Copy link
Author

commented Jul 30, 2013

Comment 4:

My initial report referred to the API of an intermediate version of the
net package. The current API is that to customize aspects of net.Dial()
you create a net.Dialer struct with a LocalAddr member then call its
.Dial(). But you're still on your own to create a suitable net.Addr
address for the LocalAddr member.
(Hopefully this makes sense now.)
@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 27, 2013

Comment 5:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 6:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 4, 2013

Comment 7:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed release-none labels Apr 10, 2015

@bradfitz

This comment has been minimized.

Copy link
Member

commented Feb 2, 2017

Does net.Resolver in Go 1.8 solve this?

If not, please file a new bug about what's tedious to do with Go 1.8 (with sample code) and reference this bug in your new bug report.

@bradfitz bradfitz closed this Feb 2, 2017

@golang golang locked and limited conversation to collaborators Feb 2, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.