Struct swarm_nl::core::DefaultHandler
source · pub struct DefaultHandler;
Expand description
Default network event handler.
Trait Implementations§
source§impl Clone for DefaultHandler
impl Clone for DefaultHandler
source§fn clone(&self) -> DefaultHandler
fn clone(&self) -> DefaultHandler
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl EventHandler for DefaultHandler
impl EventHandler for DefaultHandler
Implement EventHandler
for DefaultHandler
source§fn rpc_incoming_message_handled(&mut self, data: Vec<Vec<u8>>) -> Vec<Vec<u8>>
fn rpc_incoming_message_handled(&mut self, data: Vec<Vec<u8>>) -> Vec<Vec<u8>>
Echo the message back to the sender.
source§fn gossipsub_incoming_message_handled(
&mut self,
_source: PeerId,
_data: Vec<String>
)
fn gossipsub_incoming_message_handled( &mut self, _source: PeerId, _data: Vec<String> )
Echo the incoming gossip message to the console.
source§fn new_listen_addr(
&mut self,
_local_peer_id: PeerId,
_listener_id: ListenerId,
_addr: Multiaddr
)
fn new_listen_addr( &mut self, _local_peer_id: PeerId, _listener_id: ListenerId, _addr: Multiaddr )
Event that informs the application that we have started listening on a new multiaddr.
source§fn routing_table_updated(&mut self, _peer_id: PeerId)
fn routing_table_updated(&mut self, _peer_id: PeerId)
Event that informs the application that a new peer (with its location details) has just
been added to the routing table.
source§fn connection_established(
&mut self,
_peer_id: PeerId,
_connection_id: ConnectionId,
_endpoint: &ConnectedPoint,
_num_established: NonZeroU32,
_established_in: Duration
)
fn connection_established( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: NonZeroU32, _established_in: Duration )
Event that informs the application about a newly established connection to a peer.
source§fn connection_closed(
&mut self,
_peer_id: PeerId,
_connection_id: ConnectionId,
_endpoint: &ConnectedPoint,
_num_established: u32,
_cause: Option<ConnectionError>
)
fn connection_closed( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: u32, _cause: Option<ConnectionError> )
Event that informs the application about a closed connection to a peer.
source§fn expired_listen_addr(&mut self, _listener_id: ListenerId, _address: Multiaddr)
fn expired_listen_addr(&mut self, _listener_id: ListenerId, _address: Multiaddr)
Event that announces expired listen address.
source§fn listener_closed(
&mut self,
_listener_id: ListenerId,
_addresses: Vec<Multiaddr>
)
fn listener_closed( &mut self, _listener_id: ListenerId, _addresses: Vec<Multiaddr> )
Event that announces a closed listener.
source§fn listener_error(&mut self, _listener_id: ListenerId)
fn listener_error(&mut self, _listener_id: ListenerId)
Event that announces a listener error.
source§fn dialing(&mut self, _peer_id: Option<PeerId>, _connection_id: ConnectionId)
fn dialing(&mut self, _peer_id: Option<PeerId>, _connection_id: ConnectionId)
Event that announces a dialing attempt.
source§fn new_external_addr_candidate(&mut self, _address: Multiaddr)
fn new_external_addr_candidate(&mut self, _address: Multiaddr)
Event that announces a new external address candidate.
source§fn external_addr_confirmed(&mut self, _address: Multiaddr)
fn external_addr_confirmed(&mut self, _address: Multiaddr)
Event that announces a confirmed external address.
source§fn external_addr_expired(&mut self, _address: Multiaddr)
fn external_addr_expired(&mut self, _address: Multiaddr)
Event that announces an expired external address.
source§fn incoming_connection(
&mut self,
_connection_id: ConnectionId,
_local_addr: Multiaddr,
_send_back_addr: Multiaddr
)
fn incoming_connection( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr )
Event that announces new connection arriving on a listener and in the process of
protocol negotiation.
source§fn incoming_connection_error(
&mut self,
_connection_id: ConnectionId,
_local_addr: Multiaddr,
_send_back_addr: Multiaddr
)
fn incoming_connection_error( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr )
Event that announces an error happening on an inbound connection during its initial
handshake.
source§fn outgoing_connection_error(
&mut self,
_connection_id: ConnectionId,
_peer_id: Option<PeerId>
)
fn outgoing_connection_error( &mut self, _connection_id: ConnectionId, _peer_id: Option<PeerId> )
Event that announces an error happening on an outbound connection during its initial
handshake.
source§fn outbound_ping_success(&mut self, _peer_id: PeerId, _duration: Duration)
fn outbound_ping_success(&mut self, _peer_id: PeerId, _duration: Duration)
Event that announces the arrival of a pong message from a peer.
The duration it took for a round trip is also returned.
source§fn outbound_ping_error(&mut self, _peer_id: PeerId, _err_type: Failure)
fn outbound_ping_error(&mut self, _peer_id: PeerId, _err_type: Failure)
Event that announces a
Ping
error.source§fn identify_info_recieved(&mut self, _peer_id: PeerId, _info: Info)
fn identify_info_recieved(&mut self, _peer_id: PeerId, _info: Info)
Event that announces the arrival of a
PeerInfo
via the Identify
protocol.source§fn kademlia_put_record_success(&mut self, _key: Vec<u8>)
fn kademlia_put_record_success(&mut self, _key: Vec<u8>)
Event that announces the successful write of a record to the DHT.
source§fn kademlia_put_record_error(&mut self)
fn kademlia_put_record_error(&mut self)
Event that announces the failure of a node to save a record.
source§fn kademlia_start_providing_success(&mut self, _key: Vec<u8>)
fn kademlia_start_providing_success(&mut self, _key: Vec<u8>)
Event that announces a node as a provider of a record in the DHT.
source§fn kademlia_start_providing_error(&mut self)
fn kademlia_start_providing_error(&mut self)
Event that announces the failure of a node to become a provider of a record in the DHT.
source§fn gossipsub_unsubscribe_message_recieved(
&mut self,
_peer_id: PeerId,
_topic: String
)
fn gossipsub_unsubscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String )
Event that announces that a peer has just left a network.
source§fn gossipsub_subscribe_message_recieved(
&mut self,
_peer_id: PeerId,
_topic: String
)
fn gossipsub_subscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String )
Event that announces that a peer has just joined a network.
source§fn gossipsub_incoming_message_filtered(
&mut self,
_propagation_source: PeerId,
_message_id: MessageId,
_source: Option<PeerId>,
_topic: String,
_data: Vec<String>
) -> bool
fn gossipsub_incoming_message_filtered( &mut self, _propagation_source: PeerId, _message_id: MessageId, _source: Option<PeerId>, _topic: String, _data: Vec<String> ) -> bool
Event that announces the beginning of the filtering and authentication of the incoming
gossip message. It returns a boolean to specify whether the massage should be dropped or
should reach the application. All incoming messages are allowed in by default.
Auto Trait Implementations§
impl Freeze for DefaultHandler
impl RefUnwindSafe for DefaultHandler
impl Send for DefaultHandler
impl Sync for DefaultHandler
impl Unpin for DefaultHandler
impl UnwindSafe for DefaultHandler
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more