libp2p v0.1.0 Libp2p.DHT View Source

Functions for interacting with the Libp2p destributed hashtable.

Link to this section Summary

Functions

Clients can issue a FIND_PEER request to query the DHT for a given peer's known addresses.

Clients can issue a FIND_PEERS_CONNECTED_TO_PEER request to query the DHT for peers directly connected to a given peer in the DHT.

Clients can issue a FIND_PROVIDERS request to query the DHT for peers that have a piece of content, identified by a CID. FIND_PROVIDERS optionally include a count, specifying a maximum number of results to return.

Clients can issue a GET_CLOSEST_PEERS request to query the DHT routing table for peers that are closest to a provided key.

Clients can issue a GET_PUBLIC_KEY request to query the DHT routing table for a given peer's public key.

Clients can issue a GET_VALUE request to query the DHT for a value stored at a key in the DHT.

Clients can issue a PROVIDE request to announce that they have data addressed by a given CID.

Clients can issue a PUT_VALUE request to write a value to a key in the DHT.

Clients can issue a SEARCH_VALUE request to query the DHT for the best/most valid value stored at a given key. It will return a stream of values, terminating on the best/most valid value found. After the daemon finishes its query, it will update any peers in the DHT that returned stale or bad data for the given key with the better record.

Link to this section Functions

Clients can issue a FIND_PEER request to query the DHT for a given peer's known addresses.

Link to this function

find_peers_connected_to(peer) View Source

Clients can issue a FIND_PEERS_CONNECTED_TO_PEER request to query the DHT for peers directly connected to a given peer in the DHT.

Link to this function

find_providers(cid, count \\ 10) View Source

Clients can issue a FIND_PROVIDERS request to query the DHT for peers that have a piece of content, identified by a CID. FIND_PROVIDERS optionally include a count, specifying a maximum number of results to return.

Clients can issue a GET_CLOSEST_PEERS request to query the DHT routing table for peers that are closest to a provided key.

Clients can issue a GET_PUBLIC_KEY request to query the DHT routing table for a given peer's public key.

Clients can issue a GET_VALUE request to query the DHT for a value stored at a key in the DHT.

Clients can issue a PROVIDE request to announce that they have data addressed by a given CID.

Clients can issue a PUT_VALUE request to write a value to a key in the DHT.

Clients can issue a SEARCH_VALUE request to query the DHT for the best/most valid value stored at a given key. It will return a stream of values, terminating on the best/most valid value found. After the daemon finishes its query, it will update any peers in the DHT that returned stale or bad data for the given key with the better record.