When using js-libp2p there is a part of the configuration where the discovery mechanism for the node can be configured. You can see this, in the examples here. For example in this file you find two discovery mechanisms configured as follows:
My question now, how do one configure similar peer discovery mechanism when using rust-libp2p?
You can configure the Kademlia bootstrap nodes by calling:
Hi @mxinden thanks for the response, but unfortunately it does not help much. Might be due to my newness to libp2p.
My question was more general. How do one configure peer discovery when using rust-libp2p? What I see in the
js-libp2p is more general. I see that when creating a libp2p node it is possible to configure it. And one of the configuration attribute it support is
peerDiscovery with which I can pass in various peer discover mechanism.
Your response said:
You can configure the Kademlia bootstrap nodes
But what if I want to use
MDNS instead? Or
I am more curious to know what is the general way to configure discovery mechanism when using rust-libp2p, can’t seem to find this in the doc or examples as you have it with
There is no general way to configure all discovery mechanisms, as, in my opinion, they differ substantially and thus an abstraction would be inconsistent.
You can find an example on how to use each of the many in the examples folder:
Thanks! Found this out yesterday and I was able to configure the use of Kademlia DHT, but I have another question, which I will ask in a separate thread
@mxinden here. Will appreciate if you have any pointers