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

proposal: net: I want to listen to both 127.0.0.1 and 10.0.0.1 with a single listener #14580

Closed
mengzhuo opened this issue Mar 1, 2016 · 5 comments

Comments

@mengzhuo
Copy link
Contributor

mengzhuo commented Mar 1, 2016

https://github.com/golang/go/blob/master/src/net/ipsock.go#L204

type addrList []Addr
func internetAddrList(net, addr string, deadline time.Time) (addrList, error)

However the internetAddrList only return one valid address.
I proposal split addr string by "," and return REAL addrList.

@mikioh
Copy link
Contributor

mikioh commented Mar 1, 2016

See filterAddrList in ipsock.go. It certainly returns a list of addresses.

@mikioh mikioh closed this as completed Mar 1, 2016
@mengzhuo
Copy link
Contributor Author

mengzhuo commented Mar 1, 2016

No, I mean in

net.Listen
    |->net.resolveAddrList
           |-> net.internetAddrList

and at https://github.com/golang/go/blob/master/src/net/ipsock.go#L244
if addr string is an valid IPv4/IPv6 it would nether return multi addresses nor call filterAddrList

@mikioh
Copy link
Contributor

mikioh commented Mar 1, 2016

Can you please elaborate your problem? I don't understand what's the problem.

@mengzhuo
Copy link
Contributor Author

mengzhuo commented Mar 1, 2016

For example, If I want to listen to both 127.0.0.1 and 10.0.0.1
net.Listen can't do it.

@mikioh
Copy link
Contributor

mikioh commented Mar 1, 2016

You didn't explain your problem. I'm still not sure what's your problem but looks like you want to have a single control knob that handles multiple address families, endpoints and subflows. So this is a duplicate of #9334.

@mikioh mikioh changed the title proposal: net: internetAddrList return multiple addresses proposal: net: I want to listen to both 127.0.0.1 and 10.0.0.1 with a single listener Mar 1, 2016
@golang golang locked and limited conversation to collaborators Mar 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants