pub struct Kademlia<TSubstream> { /* fields omitted */ }
Network behaviour that handles Kademlia.
Creates a Kademlia
.
Contrary to new
, doesn't perform the initialization queries that store our local ID into
the DHT.
Starts an iterative FIND_NODE
request.
This will eventually produce an event containing the nodes of the DHT closest to the
requested PeerId
.
Starts an iterative GET_PROVIDERS
request.
Register the local node as the provider for the given key.
This will periodically send ADD_PROVIDER
messages to the nodes closest to the key. When
someone performs a GET_PROVIDERS
iterative request on the DHT, our local node will be
returned as part of the results.
The actual meaning of providing the value of a key is not defined, and is specific to
the value whose key is the hash.
Cancels a registration done with add_providing
.
There doesn't exist any "remove provider" message to broadcast on the network, therefore we
will still be registered as a provider in the DHT for as long as the timeout doesn't expire.
Handler for all the protocols the network supports.
Event generated by the swarm.
Builds a new ProtocolsHandler
.
Indicates the behaviour that we connected to the node with the given peer id through the given endpoint. Read more
Indicates the behaviour that we disconnected from the node with the given peer id. The endpoint is the one we used to be connected to. Read more
Indicates the behaviour that the node with the given peer id has generated an event for us. Read more
Polls for things that swarm should do. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)