pub enum SupportProtocols {
Show 13 variants
Ping,
Discovery,
Identify,
Feeler,
DisconnectMessage,
Sync,
RelayV2,
RelayV3,
Time,
Alert,
LightClient,
Filter,
HolePunching,
}
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.
HolePunching
HolePunching: A protocol used to connect peers behind firewalls or NAT routers.
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 moreSource§impl Debug for SupportProtocols
impl Debug for SupportProtocols
Source§impl From<SupportProtocols> for MetaBuilder
impl From<SupportProtocols> for MetaBuilder
Source§fn from(p: SupportProtocols) -> Self
fn from(p: SupportProtocols) -> Self
Auto Trait Implementations§
impl Freeze for SupportProtocols
impl RefUnwindSafe for SupportProtocols
impl Send for SupportProtocols
impl Sync for SupportProtocols
impl Unpin for SupportProtocols
impl UnwindSafe for SupportProtocols
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more