Enum litep2p::protocol::TransportEvent

source ·
pub enum TransportEvent {
    ConnectionEstablished {
        peer: PeerId,
        endpoint: Endpoint,
    },
    ConnectionClosed {
        peer: PeerId,
    },
    DialFailure {
        peer: PeerId,
        address: Multiaddr,
    },
    SubstreamOpened {
        peer: PeerId,
        protocol: ProtocolName,
        fallback: Option<ProtocolName>,
        direction: Direction,
        substream: Substream,
    },
    SubstreamOpenFailure {
        substream: SubstreamId,
        error: SubstreamError,
    },
}
Expand description

Events emitted by one of the installed transports to protocol(s).

Variants§

§

ConnectionEstablished

Connection established to peer.

Fields

§peer: PeerId

Peer ID.

§endpoint: Endpoint

Endpoint.

§

ConnectionClosed

Connection closed to peer.

Fields

§peer: PeerId

Peer ID.

§

DialFailure

Failed to dial peer.

This is reported to that protocol which initiated the connection.

Fields

§peer: PeerId

Peer ID.

§address: Multiaddr

Dialed address.

§

SubstreamOpened

Substream opened for peer.

Fields

§peer: PeerId

Peer ID.

§protocol: ProtocolName

Protocol name.

One protocol handler may handle multiple sub-protocols (such as /ipfs/identify/1.0.0 and /ipfs/identify/push/1.0.0) or it may have aliases which should be handled by the same protocol handler. When the substream is sent from transport to the protocol handler, the protocol name that was used to negotiate the substream is also sent so the protocol can handle the substream appropriately.

§fallback: Option<ProtocolName>

Fallback protocol.

§direction: Direction

Substream direction.

Informs the protocol whether the substream is inbound (opened by the remote node) or outbound (opened by the local node). This allows the protocol to distinguish between the two types of substreams and execute correct code for the substream.

Outbound substreams also contain the substream ID which allows the protocol to distinguish between different outbound substreams.

§substream: Substream

Substream.

§

SubstreamOpenFailure

Failed to open substream.

Substream open failures are reported only for outbound substreams.

Fields

§substream: SubstreamId

Substream ID.

§error: SubstreamError

Error that occurred when the substream was being opened.

Trait Implementations§

source§

impl Debug for TransportEvent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more