pub trait IP2PConnector<M>:
Send
+ Sync
+ 'static {
// Required methods
fn peers(&self) -> Vec<PeerId>;
fn connect<'life0, 'async_trait>(
&'life0 self,
peer: PeerId,
) -> Pin<Box<dyn Future<Output = Result<DynP2PConnection<M>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn listen<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = P2PConnectionListener<M>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn into_dyn(self) -> DynP2PConnector<M>
where Self: Sized { ... }
}
Expand description
Allows to connect to peers and to listen for incoming connections. Connections are message based and should be authenticated and encrypted for production deployments.