dht-crawler
dht-crawler copied to clipboard
Iterative Query Helper Method
Make a helper to asynchronously iteratively query to find_node and get_node. We would only need find_node for bootstrapping (find_node(self))
Here's what the algorithm will look like.
find_node(target):
peersOrResult = peer.find_node(target)
if result
return result
peers.first(peer => peer.find_node())
Need to prevent visiting the same peers twice. If two peers are visited twice, there could be a cycle.