net: Addr does not discriminate between different address families #10019
Labels
Comments
Not true, you can use To4 and To16 methods of net.IP. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.The text was updated successfully, but these errors were encountered: