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
- Peer
Identify Info - Peer info from identify protocol message
- Protocol
Id - Protocol id
- Public
Key - Public Key
- Service
Builder - Builder for Service
- Service
Control - Service control, used to send commands externally at runtime
- Session
Id - Index of session
Enums§
- Behaviour
- Peers behaviours we maintain a score to each peer report peer behaviour will affects peer’s score
- Session
Type - Indicates the session type
- Support
Protocols - All supported protocols
- Target
Protocol - When dial, specify which protocol want to open
- Target
Session - When sending a message, select the specified session
Traits§
- CKBProtocol
Context - Abstract protocol context
- CKBProtocol
Handler - Abstract protocol handle base on tentacle service handle
- Service
Protocol - 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§
- BoxedCKB
Protocol Context - type alias of dyn ckb protocol context
- Peer
Index - Alias session id
- Protocol
Version - Protocol version used by network protocol open