Peer address discovery through bootstrap node #5704
-
Hello, I am new to libp2p so sorry in advance if I assume something incorrectly. I have a node
I am also using the identify protocol in my behavior, but to be honest I don't know what purpose is serving. Any clarification about this will also help me. Thanks in advance. I couldn't find a proper doc talking about this, but maybe I suck at googling. EDIT: After more research, adding a call to
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It is one of many protocols that can do this, but yes you can use kademlia to discover peers
You can call
When the peer is discovered, its addressed is stored in the kbucket, which would make it dialable via
They would connect if they are added to the kbucket, which would happen when during the bootstrap process or if they are added via
You could wait for the connection to be established before sending a message, although the behaviour would do that for you already unless you want to handle the state yourself. rust-libp2p/protocols/request-response/src/lib.rs Lines 427 to 446 in b187c14 rust-libp2p/protocols/request-response/src/lib.rs Lines 729 to 747 in b187c14 rust-libp2p/protocols/request-response/src/lib.rs Lines 772 to 796 in b187c14 |
Beta Was this translation helpful? Give feedback.
It is one of many protocols that can do this, but yes you can use kademlia to discover peers
You can call
Behaviour::get_closest_peers
, which would get the closest peer.When the peer is discovered, its addressed is stored in the kbucket, which would make it dialable via
Spawn::dial
, though to get the address from the behaviour for the peers, you would need to useBehaviour::f…