Crate ckb_network

Source
Expand description

ckb network module

This module is based on the Tentacle library, once again abstract the context that protocols can use, and providing a unified implementation of the peer storage and registration mechanism.

And implemented several basic protocols: identify, discovery, ping, feeler, disconnect_message

Re-exports§

pub use crate::errors::Error;
pub use crate::network::DefaultExitHandler;
pub use crate::network::EventHandler;
pub use crate::network::ExitHandler;
pub use crate::network::NetworkController;
pub use crate::network::NetworkService;
pub use crate::network::NetworkState;
pub use crate::peer_registry::PeerRegistry;
pub use crate::peer_store::Score;
pub use p2p::bytes;
pub use p2p::multiaddr;
pub use p2p::secio;
pub use tokio;

Modules§

compress
compress module
errors
Error module
network
Global state struct and start function
peer_registry
Peer registry
peer_store
Peer store manager

Structs§

CKBProtocol
Help to build protocol meta
Flags
Node Function Identification
Peer
Peer info
PeerId
Identifier of a peer of the network
PeerIdentifyInfo
Peer info from identify protocol message
ProtocolId
Protocol id
PublicKey
Public Key
ServiceBuilder
Builder for Service
ServiceControl
Service control, used to send commands externally at runtime
SessionId
Index of session

Enums§

Behaviour
Peers behaviours we maintain a score to each peer report peer behaviour will affects peer’s score
SessionType
Indicates the session type
SupportProtocols
All supported protocols
TargetProtocol
When dial, specify which protocol want to open
TargetSession
When sending a message, select the specified session

Traits§

CKBProtocolContext
Abstract protocol context
CKBProtocolHandler
Abstract protocol handle base on tentacle service handle
ServiceProtocol
Service level protocol handle

Functions§

extract_peer_id
Get peer id from multiaddr
multiaddr_to_socketaddr
Change multiaddr to socketaddr
observe_listen_port_occupancy
Observe listen port occupancy

Type Aliases§

BoxedCKBProtocolContext
type alias of dyn ckb protocol context
PeerIndex
Alias session id
ProtocolVersion
Protocol version used by network protocol open

Attribute Macros§

async_trait