Struct pea2pea::Node [−][src]
pub struct Node(_);
Expand description
The central object responsible for handling all the connections.
Implementations
Creates a new Node
optionally using a given Config
.
Returns the node’s listening address; returns an error if the node was configured to not listen for inbound connections.
Connects to the provided SocketAddr
.
Disconnects from the provided SocketAddr
.
Sends the provided message to the specified SocketAddr
, as long as the Writing
protocol is enabled.
Broadcasts the provided message to all peers, as long as the Writing
protocol is enabled.
Returns a list containing addresses of active connections.
Returns a reference to the collection of statistics of node’s known peers.
Checks whether the provided address is connected.
Returns the number of active connections.
Returns the number of connections that are currently being set up.
pub fn set_handshake_handler(
&self,
handler: ProtocolHandler<ReturnableItem<Connection, Result<Connection>>>
)
pub fn set_handshake_handler(
&self,
handler: ProtocolHandler<ReturnableItem<Connection, Result<Connection>>>
)
Sets up the handshake handler, as part of the Handshaking
protocol.
pub fn set_reading_handler(
&self,
handler: ProtocolHandler<ReturnableItem<Connection, Result<Connection>>>
)
pub fn set_reading_handler(
&self,
handler: ProtocolHandler<ReturnableItem<Connection, Result<Connection>>>
)
Sets up the reading handler, as part of enabling the Reading
protocol.
pub fn set_writing_handler(
&self,
handler: ProtocolHandler<ReturnableItem<Connection, Result<Connection>>>
)
pub fn set_writing_handler(
&self,
handler: ProtocolHandler<ReturnableItem<Connection, Result<Connection>>>
)
Sets up the writing handler, as part of enabling the Writing
protocol.
pub fn set_disconnect_handler(
&self,
handler: ProtocolHandler<ReturnableItem<SocketAddr, ()>>
)
pub fn set_disconnect_handler(
&self,
handler: ProtocolHandler<ReturnableItem<SocketAddr, ()>>
)
Sets up the disconnect handler, as part of enabling the Disconnect
protocol.
Methods from Deref<Target = Arc<InnerNode>>
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Node
impl !UnwindSafe for Node
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more