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 tokio;

Modules

compress module

Error module

Global state struct and start function

Peer registry

Peer store manager

Structs

Control whether the protocol handle method requires blocking to run default is 0b1111, all function use blocking

Help to build protocol meta

Peer info

Identifier of a peer of the network

Peer info from identify protocol message

Protocol id

Builder for Service

Service control, used to send commands externally at runtime

Index of session

Enums

Peers behaviours we maintain a score to each peer report peer behaviour will affects peer’s score

Public Key

Indicates the session type

All supported protocols

When dial, specify which protocol want to open

When sending a message, select the specified session

Traits

Abstract protocol context

Abstract protocol handle base on tentacle service handle

Service level protocol handle

Functions

Get peer id from multiaddr

Change multiaddr to socketaddr

Observe listen port occupancy

Type Definitions

Alias session id

Protocol version used by network protocol open