fedimint_server::net::connect

Trait Connector

source
pub trait Connector<M> {
    // Required methods
    fn connect_framed<'life0, 'async_trait>(
        &'life0 self,
        destination: SafeUrl,
        peer: PeerId,
    ) -> Pin<Box<dyn Future<Output = ConnectResult<M>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn listen<'life0, 'async_trait>(
        &'life0 self,
        bind_addr: SocketAddr,
    ) -> Pin<Box<dyn Future<Output = Result<ConnectionListener<M>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn into_dyn(self) -> AnyConnector<M>
       where Self: Sized + Send + Sync + Unpin + 'static { ... }
}
Expand description

Allows to connect to peers and to listen for incoming connections

Connections are message based (FramedTransport) and should be authenticated and encrypted for production deployments.

Required Methods§

source

fn connect_framed<'life0, 'async_trait>( &'life0 self, destination: SafeUrl, peer: PeerId, ) -> Pin<Box<dyn Future<Output = ConnectResult<M>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Connect to a destination

source

fn listen<'life0, 'async_trait>( &'life0 self, bind_addr: SocketAddr, ) -> Pin<Box<dyn Future<Output = Result<ConnectionListener<M>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Listen for incoming connections on bind_addr

Provided Methods§

source

fn into_dyn(self) -> AnyConnector<M>
where Self: Sized + Send + Sync + Unpin + 'static,

Transform this concrete Connector into an owned trait object version of itself

Implementors§

source§

impl<M> Connector<M> for MockConnector
where M: Debug + Serialize + DeserializeOwned + Send + Unpin + 'static,

source§

impl<M> Connector<M> for TlsTcpConnector
where M: Debug + Serialize + DeserializeOwned + Send + Unpin + 'static,