Struct ckb_network::network::NetworkState
source · [−]pub struct NetworkState { /* private fields */ }Expand description
The global shared state of the network module
Implementations
sourceimpl NetworkState
impl NetworkState
sourcepub fn from_config(config: NetworkConfig) -> Result<NetworkState, Error>
pub fn from_config(config: NetworkConfig) -> Result<NetworkState, Error>
Init from config
sourcepub fn with_peer_registry<F, T>(&self, callback: F) -> T where
F: FnOnce(&PeerRegistry) -> T,
pub fn with_peer_registry<F, T>(&self, callback: F) -> T where
F: FnOnce(&PeerRegistry) -> T,
For restrict lock in inner scope
sourcepub fn local_peer_id(&self) -> &PeerId
pub fn local_peer_id(&self) -> &PeerId
Get peer id of local node
sourcepub fn local_private_key(&self) -> &SecioKeyPair
pub fn local_private_key(&self) -> &SecioKeyPair
Use on test
sourcepub fn public_urls(&self, max_urls: usize) -> Vec<(String, u8)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn public_urls(&self, max_urls: usize) -> Vec<(String, u8)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get local node’s listen address list
sourcepub fn get_protocol_ids<F: Fn(ProtocolId) -> bool>(
&self,
filter: F
) -> Vec<ProtocolId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_protocol_ids<F: Fn(ProtocolId) -> bool>(
&self,
filter: F
) -> Vec<ProtocolId>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
use a filter to get protocol id list
sourcepub fn dial_identify(&self, p2p_control: &ServiceControl, addr: Multiaddr)
pub fn dial_identify(&self, p2p_control: &ServiceControl, addr: Multiaddr)
Dial just identify protocol
sourcepub fn dial_feeler(&self, p2p_control: &ServiceControl, addr: Multiaddr)
pub fn dial_feeler(&self, p2p_control: &ServiceControl, addr: Multiaddr)
Dial just feeler protocol
Auto Trait Implementations
impl !RefUnwindSafe for NetworkState
impl Send for NetworkState
impl Sync for NetworkState
impl Unpin for NetworkState
impl UnwindSafe for NetworkState
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