Enum ckb_network::SupportProtocols
source · [−]pub enum SupportProtocols {
Ping,
Discovery,
Identify,
Feeler,
DisconnectMessage,
Sync,
RelayV2,
Time,
Alert,
}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.
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
sourceimpl SupportProtocols
impl SupportProtocols
sourcepub fn protocol_id(&self) -> ProtocolId
pub fn protocol_id(&self) -> ProtocolId
Protocol id
sourcepub fn support_versions(&self) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn support_versions(&self) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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
sourceimpl Clone for SupportProtocols
impl Clone for SupportProtocols
sourcefn clone(&self) -> SupportProtocols
fn clone(&self) -> SupportProtocols
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for SupportProtocols
impl Debug for SupportProtocols
sourceimpl From<SupportProtocols> for MetaBuilder
impl From<SupportProtocols> for MetaBuilder
sourcefn from(p: SupportProtocols) -> Self
fn from(p: SupportProtocols) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for SupportProtocols
impl Send for SupportProtocols
impl Sync for SupportProtocols
impl Unpin for SupportProtocols
impl UnwindSafe for SupportProtocols
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more