How to enable/disable DHT Random Walks?

Couldn’t find any mention on how to set this up in the examples, and

Relevant thread


I think Go-libp2p-kad-dht 0.3.0 released with breaking changes is exactly what you are looking for.

“Dht Randoms Walks” / “Dht Refresh” / “Look for random peer IDs in the network” is enabled by default(One aim of this release & that great writeup by @stebalien is to clear the confusing terminology).

However, you can disable it by passing in the DisableAutoRefresh option to the Dht. Then, you will have to “manually” call Dht.Refresh to perform random walks.

Please do let me know if you have any questions.

1 Like

It is indeed. Thank you @stebalien for releasing it for me :heart:

For future selves and others looking for the answer, you can find a snippet om how it is done at: