Enum ckb_network::SupportProtocols
source · pub enum SupportProtocols {
Ping,
Discovery,
Identify,
Feeler,
DisconnectMessage,
Sync,
RelayV2,
RelayV3,
Time,
Alert,
LightClient,
Filter,
}
Expand description
All supported protocols
The underlying network of CKB is flexible and complex. The flexibility lies in that it can support any number of protocols. Therefore, it is also relatively complex. Now, CKB has a bunch of protocols open by default, but not all protocols have to be open. In other words, if you want to interact with ckb nodes at the p2p layer, you only need to implement a few core protocols.
Core protocol: identify/discovery/sync/relay
Variants§
Ping
Ping: as a health check for ping/pong
Discovery
Discovery: used to communicate with any node with any known node address, to build a robust network topology as much as possible.
Identify
Identify: the first protocol opened when the nodes are interconnected, used to obtain the features, versions, and observation addresses supported by the other node.
Feeler
Feeler: used to detect whether the address is valid.
DisconnectMessage
Disconnect message: used to give the remote node a debug message when the node decides to disconnect. This message must be as quick as possible, otherwise the message may not be sent. So, use a separate protocol to support it.
Sync
Sync: ckb’s main communication protocol for synchronize all blocks.
RelayV2
Relay: ckb’s main communication protocol for synchronizing latest transactions and blocks.
RelayV3
Relay: ckb’s main communication protocol for synchronizing latest transactions and blocks. RFC
Time
Time: A protocol used for node pairing that warns if there is a large gap between the local time and the remote node.
Alert
Alert: A protocol reserved by the Nervos Foundation to publish network-wide announcements. Any information sent from the protocol is verified by multi-signature
LightClient
LightClient: A protocol used for light client.
Filter
Filter: A protocol used for client side block data filtering.
Implementations§
source§impl SupportProtocols
impl SupportProtocols
sourcepub fn protocol_id(&self) -> ProtocolId
pub fn protocol_id(&self) -> ProtocolId
Protocol id
sourcepub fn support_versions(&self) -> Vec<String>
pub fn support_versions(&self) -> Vec<String>
Support versions
sourcepub fn max_frame_length(&self) -> usize
pub fn max_frame_length(&self) -> usize
Protocol message max length
sourcepub fn build_meta_with_service_handle<SH: FnOnce() -> ProtocolHandle<Box<dyn ServiceProtocol + Send + Unpin + 'static>>>(
self,
service_handle: SH
) -> ProtocolMeta
pub fn build_meta_with_service_handle<SH: FnOnce() -> ProtocolHandle<Box<dyn ServiceProtocol + Send + Unpin + 'static>>>( self, service_handle: SH ) -> ProtocolMeta
Builder with service handle
Trait Implementations§
source§impl Clone for SupportProtocols
impl Clone for SupportProtocols
source§fn clone(&self) -> SupportProtocols
fn clone(&self) -> SupportProtocols
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more