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.