pub struct KademliaHandler<TSubstream, TUserData> where
TSubstream: AsyncRead + AsyncWrite, { /* fields omitted */ }
Protocol handler that handles Kademlia communications with the remote.
The handler will automatically open a Kademlia substream with the remote for each request we
make.
It also handles requests made by the remote.
Create a KademliaHandler
that only allows sending messages to the remote but denying
incoming connections.
Create a KademliaHandler
that only allows sending messages but also receive incoming
requests.
The Default
trait implementation wraps around this function.
Returns the "default value" for a type. Read more
Custom event that can be received from the outside.
Custom event that can be produced by the handler and that will be returned to the outside.
Error that can happen when polling.
The type of the substream that contains the raw data.
The upgrade for the protocol or protocols handled by this handler.
The upgrade for the protocol or protocols handled by this handler.
Information about a substream. Can be sent to the handler through a NodeHandlerEndpoint
, and will be passed back in inject_substream
or inject_outbound_closed
. Read more
Produces a ConnectionUpgrade
for the protocol or protocols to accept when listening. Read more
Injects a fully-negotiated substream in the handler. Read more
Injects an event coming from the outside in the handler.
Indicates to the handler that the inbound part of the muxer has been closed, and that therefore no more inbound substreams will be produced. Read more
Indicates to the handler that upgrading a substream to the given protocol has failed.
Returns whether the connection should be kept alive. Read more
Indicates to the node that it should shut down. After that, it is expected that poll()
returns Ready(ProtocolsHandlerEvent::Shutdown)
as soon as possible. Read more
Should behave like Stream::poll()
. Should close if no more event can be produced and the node should be closed. Read more
Adds a closure that turns the input event into something else.
Adds a closure that turns the output event into something else.
Builds an implementation of ProtocolsHandler
that handles both this protocol and the other one together. Read more
Creates a builder that will allow creating a NodeHandler
that handles this protocol exclusively. Read more
Deprecated:
Use into_node_handler_builder instead
Builds an implementation of NodeHandler
that handles this protocol exclusively. 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
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
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Builds an implementation of IntoProtocolsHandler
that handles both this protocol and the other one together. Read more
Creates a builder that will allow creating a NodeHandler
that handles this protocol exclusively. Read more