Struct libp2p_core::transport::upgrade::Upgrade
source · pub struct Upgrade<T, U> { /* private fields */ }
Implementations
Trait Implementations
sourceimpl<D, U, O, E> Transport for Upgrade<D, U>where
D: Transport,
D::Output: AsyncRead + AsyncWrite,
U: InboundUpgrade<D::Output, Output = O, Error = E>,
U: OutboundUpgrade<D::Output, Output = O, Error = E> + Clone,
E: Error + Send + Sync + 'static,
impl<D, U, O, E> Transport for Upgrade<D, U>where
D: Transport,
D::Output: AsyncRead + AsyncWrite,
U: InboundUpgrade<D::Output, Output = O, Error = E>,
U: OutboundUpgrade<D::Output, Output = O, Error = E> + Clone,
E: Error + Send + Sync + 'static,
type Output = O
type Output = O
The raw connection to a peer.
type Listener = ListenerStream<<D as Transport>::Listener, U>
type Listener = ListenerStream<<D as Transport>::Listener, U>
The listener produces incoming connections. Read more
type ListenerUpgrade = ListenerUpgradeFuture<<D as Transport>::ListenerUpgrade, U>
type ListenerUpgrade = ListenerUpgradeFuture<<D as Transport>::ListenerUpgrade, U>
After a connection has been received, we may need to do some asynchronous pre-processing
on it (e.g. an intermediary protocol negotiation). While this pre-processing takes place, we
want to be able to continue polling on the listener. Read more
type Dial = DialUpgradeFuture<<D as Transport>::Dial, U>
type Dial = DialUpgradeFuture<<D as Transport>::Dial, U>
A future which indicates that we are currently dialing to a peer.
sourcefn dial(self, addr: Multiaddr) -> Result<Self::Dial, (Self, Multiaddr)>
fn dial(self, addr: Multiaddr) -> Result<Self::Dial, (Self, Multiaddr)>
Dial the given multi-addr. Read more
sourcefn listen_on(
self,
addr: Multiaddr
) -> Result<(Self::Listener, Multiaddr), (Self, Multiaddr)>
fn listen_on(
self,
addr: Multiaddr
) -> Result<(Self::Listener, Multiaddr), (Self, Multiaddr)>
Listen on the given multiaddr. Returns a stream of incoming connections, plus a modified
version of the
Multiaddr
. This new Multiaddr
is the one that that should be advertised
to other nodes, instead of the one passed as parameter. Read moresourcefn nat_traversal(
&self,
server: &Multiaddr,
observed: &Multiaddr
) -> Option<Multiaddr>
fn nat_traversal(
&self,
server: &Multiaddr,
observed: &Multiaddr
) -> Option<Multiaddr>
Takes a multiaddress we’re listening on (
server
), and tries to convert it to an
externally-visible multiaddress. In order to do so, we pass an observed
address which
a remote node observes for one of our dialers. Read moresourcefn map<F, O>(self, map: F) -> Map<Self, F>where
Self: Sized,
F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone,
fn map<F, O>(self, map: F) -> Map<Self, F>where
Self: Sized,
F: FnOnce(Self::Output, ConnectedPoint) -> O + Clone,
Applies a function on the output of the
Transport
.sourcefn map_err<F>(self, map_err: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(IoError) -> IoError + Clone,
fn map_err<F>(self, map_err: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(IoError) -> IoError + Clone,
Applies a function on the errors generated by the futures of the
Transport
.sourcefn map_err_dial<F>(self, map_err: F) -> MapErrDial<Self, F>where
Self: Sized,
F: FnOnce(IoError, Multiaddr) -> IoError,
fn map_err_dial<F>(self, map_err: F) -> MapErrDial<Self, F>where
Self: Sized,
F: FnOnce(IoError, Multiaddr) -> IoError,
Applies a function on the errors generated by the futures of the
Transport
when dialing. Read moresourcefn or_transport<T>(self, other: T) -> OrTransport<Self, T>where
Self: Sized,
fn or_transport<T>(self, other: T) -> OrTransport<Self, T>where
Self: Sized,
sourcefn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C>where
Self: Sized,
C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
F: IntoFuture<Item = O, Error = IoError>,
fn and_then<C, F, O>(self, upgrade: C) -> AndThen<Self, C>where
Self: Sized,
C: FnOnce(Self::Output, ConnectedPoint) -> F + Clone,
F: IntoFuture<Item = O, Error = IoError>,
Wraps this transport inside an upgrade. Whenever a connection that uses this transport
is established, it is wrapped inside the upgrade. Read more
sourcefn with_timeout(self, timeout: Duration) -> TransportTimeout<Self>where
Self: Sized,
fn with_timeout(self, timeout: Duration) -> TransportTimeout<Self>where
Self: Sized,
Adds a timeout to the connection and upgrade steps for all the sockets created by
the transport. Read more
sourcefn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>where
Self: Sized,
fn with_outbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>where
Self: Sized,
Adds a timeout to the connection and upgrade steps for all the outgoing sockets created
by the transport. Read more
sourcefn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>where
Self: Sized,
fn with_inbound_timeout(self, timeout: Duration) -> TransportTimeout<Self>where
Self: Sized,
Adds a timeout to the connection and upgrade steps for all the incoming sockets created
by the transport. Read more
impl<T: Copy, U: Copy> Copy for Upgrade<T, U>
Auto Trait Implementations
impl<T, U> RefUnwindSafe for Upgrade<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Upgrade<T, U>where
T: Send,
U: Send,
impl<T, U> Sync for Upgrade<T, U>where
T: Sync,
U: Sync,
impl<T, U> Unpin for Upgrade<T, U>where
T: Unpin,
U: Unpin,
impl<T, U> UnwindSafe for Upgrade<T, U>where
T: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more