Enum ckb_network::SupportProtocols[][src]

pub enum SupportProtocols {
    Ping,
    Discovery,
    Identify,
    Feeler,
    DisconnectMessage,
    Sync,
    Relay,
    Time,
    Alert,
}

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.

RFC

Feeler

Feeler: used to detect whether the address is valid.

RFC Eclipse Attacks on Bitcoin’s Peer-to-Peer Network

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.

RFC

Relay

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

Implementations

impl SupportProtocols[src]

pub fn protocol_id(&self) -> ProtocolId[src]

Protocol id

pub fn name(&self) -> String[src]

Protocol name

pub fn support_versions(&self) -> Vec<String>[src]

Support versions

pub fn max_frame_length(&self) -> usize[src]

Protocol message max length

pub fn flag(&self) -> BlockingFlag[src]

Blocking flag

pub fn build_meta_with_service_handle<SH: FnOnce() -> ProtocolHandle<Box<dyn ServiceProtocol + Send + Unpin + 'static>>>(
    self,
    service_handle: SH
) -> ProtocolMeta
[src]

Builder with service handle

Trait Implementations

impl Clone for SupportProtocols[src]

impl Debug for SupportProtocols[src]

impl Into<MetaBuilder> for SupportProtocols[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsAny for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,