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

Projects
None yet
3 participants
@mengzhuo
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2016

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

@mikioh mikioh closed this Mar 1, 2016

@mengzhuo

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2016

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

@mengzhuo

This comment has been minimized.

Copy link
Contributor Author

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

This comment has been minimized.

Copy link
Contributor

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.
You can’t perform that action at this time.