Skip to content

Return only non-deprecated temporary IPv6 addresses in node.js #2871

Open
@achingbrain

Description

When we listen a wildcard interface (e.g. add /ip4/0.0.0.0/tcp/0 or /ip6/::/tcp/0 to addresses.listen), the transport in question loops over the output of os.networkInterfaces() to work out which addresses the node is reachable on.

This works find for IPv4, but for IPv6 we get a multiple addresses reported for the interface.

Because IPv6 addresses can identify a host uniquely in the world, OSs generate temporary addresses for traffic that will leave the local network as a privacy measure.

Each temporary address exists for a limited time - when a new temporary address is generated, older addresses are marked "deprecated" which means they'll be removed at some point in the near future.

Ideally when reporting the addresses we are listening on, we'd filter out any deprecated addresses to keep our peer records small and to avoid broadcasting soon-to-be-removed addresses.

Unfortunately this information is not available in the Node.js API.

An alternative is to use the network-interfaces-plus module which uses a native add-on to access the flags for each interface. The module is not well used and it's compatibility with current or future versions of Node.js is unclear, there may be other options.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions