mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-25 03:02:12 +00:00
* Ignore a node's own addresses on dialing. Dialing attempts of a local node to one of its own addresses for what appears to be a different peer ID are futile and bound to fail with an `InvalidPeerId` error. To avoid such futile dialing attempts, filter out the node's own addresses from the addresses reported by the `NetworkBehaviour` for any peer. There can be a few reasons why a `NetworkBehaviour` may think an address belongs to a different peer, e.g.: 1. In the context of e.g. `libp2p-kad`, the local node may have changed its network identity (e.g. key rotation) and "discovers" its former identity in the DHT, with the same address(es). 2. Another peer may erroneously or intentionally, possibly even maliciously, report one of the local node's addresses as its own, making the node try to connect to itself. Relates to https://github.com/paritytech/stakingops-issues/issues/18. * Remove filtering of external addresses. Since these are obtained from other peers, it would constitute an attack vector. It is furthermore usually not possible for a peer behind a NAT to dial its own external address so these are unlikely to cause `InvalidPeerId` errors as a result of a peer dialing itself under the expectation of one of its former peer IDs.