libp2p / js-libp2p

The JavaScript Implementation of libp2p networking stack.
https://libp2p.io
Other
2.27k stars 435 forks source link

feat: add isDialable method to libp2p #2479

Closed achingbrain closed 3 months ago

achingbrain commented 3 months ago

Dialing peers is expensive, as are peer routing queries. Dials can be rejected due to configuration (no transport, connection gating, etc) - if a user is in the middle of a routing query they may wish to test dialability and continue the query instead of assuming they've found a dialable peer.

Adds an isDialable method to libp2p that given one or more multiaddrs, allows testing them to ensure libp2p won't immediately reject the dial attempt due to how the node has been configured.

Change checklist