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: Addr does not discriminate between different address families #10019

Closed
larsks opened this issue Feb 27, 2015 · 1 comment
Closed

net: Addr does not discriminate between different address families #10019

larsks opened this issue Feb 27, 2015 · 1 comment

Comments

@larsks
Copy link

larsks commented Feb 27, 2015

Calling interface.Addrs() to get the list of addresses assigned to a network interface returns all of the available addresses with no information about the associated address family. This method call should either (a) permit the caller to restrict the returned information to a specific address family (e.g., interface.Addrs(AF_INET) or (b) should return information with each address indicating the associated address family.

Given an interface with addresses from multiple families (e.g., AF_INET, AF_INET6), the only way for a caller to identify addresses of a certain type is to "guess" by matching them against regular expressions, which would be prone to failure in the presence of incompatible address families that happened to use the same format for addresses.

@mikioh
Copy link
Contributor

mikioh commented Feb 27, 2015

the only way for a caller to identify addresses of a certain type is to "guess" by matching them against regular expressions

Not true, you can use To4 and To16 methods of net.IP.

@mikioh mikioh closed this as completed Feb 27, 2015
@mikioh mikioh changed the title net.Addrs does not descriminate between different address families net: Addrs does not discriminate between different address families Feb 27, 2015
@mikioh mikioh changed the title net: Addrs does not discriminate between different address families net: Addr does not discriminate between different address families Feb 27, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
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