pub type Libp2pEvent = SwarmEvent<Libp2pBehaviourEvent, THandlerErr<Libp2pBehaviour>>;Aliased Type§
pub enum Libp2pEvent {
Behaviour(Libp2pBehaviourEvent),
ConnectionEstablished {
peer_id: PeerId,
connection_id: ConnectionId,
endpoint: ConnectedPoint,
num_established: NonZero<u32>,
concurrent_dial_errors: Option<Vec<(Multiaddr, TransportError<Error>)>>,
established_in: Duration,
},
ConnectionClosed {
peer_id: PeerId,
connection_id: ConnectionId,
endpoint: ConnectedPoint,
num_established: u32,
cause: Option<ConnectionError<Either<Either<Either<Void, Error>, Error>, Error>>>,
},
IncomingConnection {
connection_id: ConnectionId,
local_addr: Multiaddr,
send_back_addr: Multiaddr,
},
IncomingConnectionError {
connection_id: ConnectionId,
local_addr: Multiaddr,
send_back_addr: Multiaddr,
error: ListenError,
},
OutgoingConnectionError {
connection_id: ConnectionId,
peer_id: Option<PeerId>,
error: DialError,
},
NewListenAddr {
listener_id: ListenerId,
address: Multiaddr,
},
ExpiredListenAddr {
listener_id: ListenerId,
address: Multiaddr,
},
ListenerClosed {
listener_id: ListenerId,
addresses: Vec<Multiaddr>,
reason: Result<(), Error>,
},
ListenerError {
listener_id: ListenerId,
error: Error,
},
Dialing {
peer_id: Option<PeerId>,
connection_id: ConnectionId,
},
}Variants§
Behaviour(Libp2pBehaviourEvent)
Event generated by the NetworkBehaviour.
ConnectionEstablished
A connection to the given peer has been opened.
Fields
peer_id: PeerIdIdentity of the peer that we have connected to.
connection_id: ConnectionIdIdentifier of the connection.
endpoint: ConnectedPointEndpoint of the connection that has been opened.
num_established: NonZero<u32>Number of established connections to this peer, including the one that has just been opened.
ConnectionClosed
A connection with the given peer has been closed, possibly as a result of an error.
Fields
peer_id: PeerIdIdentity of the peer that we have connected to.
connection_id: ConnectionIdIdentifier of the connection.
endpoint: ConnectedPointEndpoint of the connection that has been closed.
IncomingConnection
A new connection arrived on a listener and is in the process of protocol negotiation.
A corresponding ConnectionEstablished or
IncomingConnectionError event will later be
generated for this connection.
Fields
connection_id: ConnectionIdIdentifier of the connection.
local_addr: MultiaddrLocal connection address.
This address has been earlier reported with a NewListenAddr
event.
send_back_addr: MultiaddrAddress used to send back data to the remote.
IncomingConnectionError
An error happened on an inbound connection during its initial handshake.
This can include, for example, an error during the handshake of the encryption layer, or the connection unexpectedly closed.
Fields
connection_id: ConnectionIdIdentifier of the connection.
local_addr: MultiaddrLocal connection address.
This address has been earlier reported with a NewListenAddr
event.
send_back_addr: MultiaddrAddress used to send back data to the remote.
error: ListenErrorThe error that happened.
OutgoingConnectionError
An error happened on an outbound connection.
Fields
connection_id: ConnectionIdIdentifier of the connection.
error: DialErrorError that has been encountered.
NewListenAddr
One of our listeners has reported a new local listening address.
Fields
listener_id: ListenerIdThe listener that is listening on the new address.
address: MultiaddrThe new address that is being listened on.
ExpiredListenAddr
One of our listeners has reported the expiration of a listening address.
Fields
listener_id: ListenerIdThe listener that is no longer listening on the address.
address: MultiaddrThe expired address.
ListenerClosed
One of the listeners gracefully closed.
Fields
listener_id: ListenerIdThe listener that closed.
addresses: Vec<Multiaddr>The addresses that the listener was listening on. These addresses are now considered
expired, similar to if a ExpiredListenAddr event
has been generated for each of them.
ListenerError
One of the listeners reported a non-fatal error.
Dialing
A new dialing attempt has been initiated by the [NetworkBehaviour]
implementation.
A ConnectionEstablished event is
reported if the dialing attempt succeeds, otherwise a
OutgoingConnectionError event
is reported.