Trait reth_network::protocol::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§