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.
- include, misc: Add net interface API. libuv/libuv#1371 adds the relevant feature in libuv
- Add more information to os.networkInterfaces() output? nodejs/node#14977 tracks the issue in Node.js
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