Crate ckb_network[−][src]
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::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 tokio; |
Modules
| errors | Error module |
| network | Global state struct and start function |
| peer_registry | Peer registry |
| peer_store | Peer store manager |
Structs
| BlockingFlag | Control whether the protocol handle method requires blocking to run default is 0b1111, all function use blocking |
| CKBProtocol | Help to build protocol meta |
| Peer | Peer info |
| PeerId | Identifier of a peer of the network |
| PeerIdentifyInfo | Peer info from identify protocol message |
| ProtocolId | Protocol id |
| ServiceControl | Service control, used to send commands externally at runtime |
Enums
| Behaviour | Peers behaviours we maintain a score to each peer report peer bahaviour will affects peer’s score |
| PublicKey | Public Key |
| SessionType | Indicates the session type |
| SupportProtocols | All supported protocols |
| 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 |
Type Definitions
| PeerIndex | Alias session id |
| ProtocolVersion | Protocol version used by network protocol open |