Struct libp2p_identify::IdentifyTransport
source · pub struct IdentifyTransport<TTrans> { /* private fields */ }
Expand description
Wraps around an implementation of Transport
that yields a muxer. Will use the muxer to
open a substream with the remote and retreive its peer id. Then yields a
(PeerId, impl StreamMuxer)
.
This transport can be used if you don’t use any encryption layer, or if you want to make
encryption optional, in which case you have no other way to know the PeerId
of the remote
than to ask for it.
Note: If you use this transport, keep in mind that the
PeerId
returned by the remote can be anything and shouldn’t necessarily be trusted.
Implementations
sourceimpl<TTrans> IdentifyTransport<TTrans>
impl<TTrans> IdentifyTransport<TTrans>
Trait Implementations
sourceimpl<TTrans: Clone> Clone for IdentifyTransport<TTrans>
impl<TTrans: Clone> Clone for IdentifyTransport<TTrans>
sourcefn clone(&self) -> IdentifyTransport<TTrans>
fn clone(&self) -> IdentifyTransport<TTrans>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<TTrans: Debug> Debug for IdentifyTransport<TTrans>
impl<TTrans: Debug> Debug for IdentifyTransport<TTrans>
sourceimpl<TTrans, TMuxer> Transport for IdentifyTransport<TTrans>where
TTrans: Transport<Output = TMuxer>,
TMuxer: StreamMuxer + Send + Sync + 'static,
TMuxer::Substream: Send + Sync + 'static,
impl<TTrans, TMuxer> Transport for IdentifyTransport<TTrans>where
TTrans: Transport<Output = TMuxer>,
TMuxer: StreamMuxer + Send + Sync + 'static,
TMuxer::Substream: Send + Sync + 'static,
type Listener = Empty<(<IdentifyTransport<TTrans> as Transport>::ListenerUpgrade, Multiaddr), Error>
type Listener = Empty<(<IdentifyTransport<TTrans> as Transport>::ListenerUpgrade, Multiaddr), Error>
The listener produces incoming connections. Read more
type ListenerUpgrade = Empty<<IdentifyTransport<TTrans> as Transport>::Output, Error>
type ListenerUpgrade = Empty<<IdentifyTransport<TTrans> as Transport>::Output, Error>
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 = AndThen<<TTrans as Transport>::Dial, MapErr<IdRetriever<TMuxer>, fn(_: UpgradeError<Error>) -> Error>, fn(_: TMuxer) -> MapErr<IdRetriever<TMuxer>, fn(_: UpgradeError<Error>) -> Error>>
type Dial = AndThen<<TTrans as Transport>::Dial, MapErr<IdRetriever<TMuxer>, fn(_: UpgradeError<Error>) -> Error>, fn(_: TMuxer) -> MapErr<IdRetriever<TMuxer>, fn(_: UpgradeError<Error>) -> Error>>
A future which indicates that we are currently dialing to a peer.
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 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 nat_traversal(&self, a: &Multiaddr, b: &Multiaddr) -> Option<Multiaddr>
fn nat_traversal(&self, a: &Multiaddr, b: &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(Error) -> Error + Clone,
fn map_err<F>(self, map_err: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Error) -> Error + 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(Error, Multiaddr) -> Error,
fn map_err_dial<F>(self, map_err: F) -> MapErrDial<Self, F>where
Self: Sized,
F: FnOnce(Error, Multiaddr) -> Error,
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 = Error>,
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 = Error>,
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
Auto Trait Implementations
impl<TTrans> RefUnwindSafe for IdentifyTransport<TTrans>where
TTrans: RefUnwindSafe,
impl<TTrans> Send for IdentifyTransport<TTrans>where
TTrans: Send,
impl<TTrans> Sync for IdentifyTransport<TTrans>where
TTrans: Sync,
impl<TTrans> Unpin for IdentifyTransport<TTrans>where
TTrans: Unpin,
impl<TTrans> UnwindSafe for IdentifyTransport<TTrans>where
TTrans: 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