[][src]Trait tari_comms::transports::Transport

pub trait Transport {
    type Output;
    type Error: Error + Send + Sync;
    type Inbound: Future<Output = Result<Self::Output, Self::Error>> + Send;
    type Listener: Stream<Item = Result<(Self::Inbound, Multiaddr), Self::Error>> + Send + Unpin;
    type ListenFuture: Future<Output = Result<(Self::Listener, Multiaddr), Self::Error>> + Send + Unpin;
    type DialFuture: Future<Output = Result<Self::Output, Self::Error>> + Send + Unpin;
    fn listen(&self, addr: Multiaddr) -> Result<Self::ListenFuture, Self::Error>;
fn dial(&self, addr: Multiaddr) -> Result<Self::DialFuture, Self::Error>; }

Associated Types

type Output

The output of the transport after a connection is established

type Error: Error + Send + Sync

Transport error type

type Inbound: Future<Output = Result<Self::Output, Self::Error>> + Send

A future which resolves to Self::Output

type Listener: Stream<Item = Result<(Self::Inbound, Multiaddr), Self::Error>> + Send + Unpin

A stream which emits Self::InboundFuture whenever a successful inbound connection is made

type ListenFuture: Future<Output = Result<(Self::Listener, Multiaddr), Self::Error>> + Send + Unpin

The future returned from the listen method.

type DialFuture: Future<Output = Result<Self::Output, Self::Error>> + Send + Unpin

The future returned from the dial method.

Loading content...

Required methods

fn listen(&self, addr: Multiaddr) -> Result<Self::ListenFuture, Self::Error>

Listen for connections on the given multiaddr

fn dial(&self, addr: Multiaddr) -> Result<Self::DialFuture, Self::Error>

Connect (dial) to the given multiaddr

Loading content...

Implementors

impl Transport for MemoryTransport[src]

type Error = Error

type Inbound = Ready<Result<Self::Output, Self::Error>>

type Listener = Listener

type Output = MemorySocket

type DialFuture = impl Future<Output = Result<Self::Output>>

type ListenFuture = impl Future<Output = Result<(Self::Listener, Multiaddr)>>

impl Transport for SocksTransport[src]

impl Transport for TcpTransport[src]

type Error = Error

type Inbound = Ready<Result<Self::Output>>

type Listener = TcpInbound

type Output = TcpSocket

type DialFuture = impl Future<Output = Result<Self::Output>>

type ListenFuture = impl Future<Output = Result<(Self::Listener, Multiaddr)>>

impl Transport for TcpWithTorTransport[src]

type Error = Error

type Inbound = <TcpTransport as Transport>::Inbound

type ListenFuture = <TcpTransport as Transport>::ListenFuture

type Listener = <TcpTransport as Transport>::Listener

type Output = TcpSocket

type DialFuture = impl Future<Output = Result<Self::Output>>

Loading content...