js-libp2p
js-libp2p copied to clipboard
[discovery] Connect to closest peers in the network to share peer information
In order for nodes on the network to be able to easily find a libp2p node, it needs to find its closest peers on the network and connect to them in order to exchange address records. This will enable other peers who don't yet know the address to search for the PeerId on the network (via the DHT, delegate routers, or other future modules). This query will result in discovering peers who know about our addresses, because we have already exchanged that information with them.
js-libp2p currently does not do this out of the box. As long as we have PeerRouting modules enabled, we should attempt to do this.
- When libp2p boots it should search for its closest peers and attempt to connect to them (this may require relays with
Active HOPsupport). - When libp2p changes announce addresses, it should search and connect again. This will help ensure the closest nodes on the network have the latest addresses.
- We should avoid querying too frequently to update. On boot we are likely to be more actively finding addresses dynamically, especially if AutoRelay/AutoNAT is enabled.
- We should attempt to maintain connections to our closest peers, as they will get push notifications whenever address changes occur.
Ref: https://github.com/ipfs/go-ipfs/issues/7433#issuecomment-656410330
This is partially implemented in [email protected].
Closing as completed