Trait ProtocolHandler
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: FixedBytes<64>,
) -> 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§
type ConnectionHandler: ConnectionHandler
type ConnectionHandler: ConnectionHandler
The type responsible for negotiating the protocol with the remote.
Required Methods§
fn on_incoming(
&self,
socket_addr: SocketAddr,
) -> Option<Self::ConnectionHandler>
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.
fn on_outgoing(
&self,
socket_addr: SocketAddr,
peer_id: FixedBytes<64>,
) -> Option<Self::ConnectionHandler>
fn on_outgoing( &self, socket_addr: SocketAddr, peer_id: FixedBytes<64>, ) -> 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.