libp2p / go-libp2p-kad-dht

A Kademlia DHT implementation on go-libp2p
https://github.com/libp2p/specs/tree/master/kad-dht
MIT License
516 stars 220 forks source link

Improve query capabilities #932

Closed iand closed 9 months ago

iand commented 9 months ago

Rework the Coordinator's Query method into two separate versions:

QueryClosest attempts to find the closest nodes to a key and returns the ones it finds QueryMessage iterates closer nodes using a supplied message

Also allows the NumResults query config option to be specified when starting a query. This specifies the minimum number of nodes to successfully contact before considering iteration complete. A query is considered to be exhausted when it has received responses from at least this number of nodes and there are no closer nodes remaining to be contacted.

Also implements the basic version of DHT.GetValue and a simple test that fetches a value from another node in the network using a query.