reth_network::protocol

Trait ProtocolHandler

Source
pub trait ProtocolHandler:
    Debug
    + Send
    + Sync
    + 'static {
    type ConnectionHandler: ConnectionHandler;

    // Required methods
    fn on_incoming(
        &self,
        socket_addr: SocketAddr,
    ) -> Option<Self::ConnectionHandler>;
    fn on_outgoing(
        &self,
        socket_addr: SocketAddr,
        peer_id: PeerId,
    ) -> Option<Self::ConnectionHandler>;
}
Expand description

A trait that allows to offer additional RLPx-based application-level protocols when establishing a peer-to-peer connection.

Required Associated Types§

Source

type ConnectionHandler: ConnectionHandler

The type responsible for negotiating the protocol with the remote.

Required Methods§

Source

fn on_incoming( &self, socket_addr: SocketAddr, ) -> Option<Self::ConnectionHandler>

Invoked when a new incoming connection from the remote is requested

If protocols for this outgoing should be announced to the remote, return a connection handler.

Source

fn on_outgoing( &self, socket_addr: SocketAddr, peer_id: PeerId, ) -> Option<Self::ConnectionHandler>

Invoked when a new outgoing connection to the remote is requested.

If protocols for this outgoing should be announced to the remote, return a connection handler.

Implementors§