pub trait ConnectionHandler:
Send
+ Sync
+ 'static {
type Connection: Stream<Item = BytesMut> + Send + 'static;
// Required methods
fn protocol(&self) -> Protocol;
fn on_unsupported_by_peer(
self,
supported: &SharedCapabilities,
direction: Direction,
peer_id: FixedBytes<64>,
) -> OnNotSupported;
fn into_connection(
self,
direction: Direction,
peer_id: FixedBytes<64>,
conn: ProtocolConnection,
) -> Self::Connection;
// Provided method
fn inbound_limits(&self) -> ProtocolIngressLimits { ... }
}network only.Expand description
A trait that allows to authenticate a protocol after the RLPx connection was established.
Required Associated Types§
Sourcetype Connection: Stream<Item = BytesMut> + Send + 'static
type Connection: Stream<Item = BytesMut> + Send + 'static
The connection that yields messages to send to the remote.
The connection will be closed when this stream resolves.
Required Methods§
Sourcefn protocol(&self) -> Protocol
fn protocol(&self) -> Protocol
Returns the protocol to announce when the RLPx connection will be established.
This will be negotiated with the remote peer.
Sourcefn on_unsupported_by_peer(
self,
supported: &SharedCapabilities,
direction: Direction,
peer_id: FixedBytes<64>,
) -> OnNotSupported
fn on_unsupported_by_peer( self, supported: &SharedCapabilities, direction: Direction, peer_id: FixedBytes<64>, ) -> OnNotSupported
Invoked when the RLPx connection has been established by the peer does not share the
protocol.
Sourcefn into_connection(
self,
direction: Direction,
peer_id: FixedBytes<64>,
conn: ProtocolConnection,
) -> Self::Connection
fn into_connection( self, direction: Direction, peer_id: FixedBytes<64>, conn: ProtocolConnection, ) -> Self::Connection
Invoked when the RLPx connection was established and the eth Status handshake
succeeded.
Messages arriving before Status completes are queued within Self::inbound_limits
and an aggregate handshake budget of 256 KiB or 64 messages, whichever is reached first.
The callback runs when the authenticated connection is first polled.
The returned future should resolve when the connection should disconnect.
Provided Methods§
Sourcefn inbound_limits(&self) -> ProtocolIngressLimits
fn inbound_limits(&self) -> ProtocolIngressLimits
Returns local resource limits for inbound messages of this protocol.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".