Skip to content

net: add Interface.InterfaceAddrs #42694

@jeroenjacobs79

Description

@jeroenjacobs79

Update, Sep 15 2021 Current proposal is #42694 -@rsc


Background

IPv6 has a concept of "privacy extensions" (RFC4941). When these extensions are active, a temporary IPv6 address is created, and is used for outbound connections. One this address expires, it gets the status "expired", and a new temporary IPv6 address is created.

Reason for this proposal

At the moment, when we use net.Interfaces(), we can get a list of associated addresses using the .Addrs() method. However, there is no platform-independent way to determine if the IPv6 address are temporary or deprecated. We need to resort to running and parsing output of ip, ifconfig, and ipconfig. IPv6 keeps growing, so frameworks and programming languages need to support the more advanced features of IPv6 in the near future.

Possible solutions

  • Add functions like IsTemporary() and isDeprecated() to net.IP (similar to isLoopback). However, that might not be the best solution, as the temporary nature of the address is not strictly tied to the numbers of the IP address.
  • Add extra functions to net.Interface type to determine expired and temporary addresses?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Accepted

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions