Struct ckb_network::network::NetworkController
source · [−]pub struct NetworkController { /* private fields */ }Expand description
Network controller
Implementations
sourceimpl NetworkController
impl NetworkController
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,
Node listen address list
sourcepub fn remove_node(&self, peer_id: &PeerId)
pub fn remove_node(&self, peer_id: &PeerId)
Disconnect session with peer id
sourcepub fn get_banned_addrs(&self) -> Vec<BannedAddr>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_banned_addrs(&self) -> Vec<BannedAddr>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get banned peer list
sourcepub fn clear_banned_addrs(&self)
pub fn clear_banned_addrs(&self)
Clear banned list
sourcepub fn connected_peers(&self) -> Vec<(PeerIndex, Peer)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn connected_peers(&self) -> Vec<(PeerIndex, Peer)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Return all connected peers’ information
sourcepub fn ban_peer(&self, peer_index: PeerIndex, duration: Duration, reason: String)
pub fn ban_peer(&self, peer_index: PeerIndex, duration: Duration, reason: String)
Ban an peer through peer index
sourcepub fn broadcast(
&self,
proto_id: ProtocolId,
data: Bytes
) -> Result<(), SendErrorKind>
pub fn broadcast(
&self,
proto_id: ProtocolId,
data: Bytes
) -> Result<(), SendErrorKind>
Broadcast a message to all connected peers
sourcepub fn quick_broadcast(
&self,
proto_id: ProtocolId,
data: Bytes
) -> Result<(), SendErrorKind>
pub fn quick_broadcast(
&self,
proto_id: ProtocolId,
data: Bytes
) -> Result<(), SendErrorKind>
Broadcast a message to all connected peers through quick queue
sourcepub fn send_message_to(
&self,
session_id: SessionId,
proto_id: ProtocolId,
data: Bytes
) -> Result<(), SendErrorKind>
pub fn send_message_to(
&self,
session_id: SessionId,
proto_id: ProtocolId,
data: Bytes
) -> Result<(), SendErrorKind>
Send message to one connected peer
sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
network message processing controller, always true, if false, discard any received messages
sourcepub fn set_active(&self, active: bool)
pub fn set_active(&self, active: bool)
Change active status, if set false discard any received messages
sourcepub fn protocols(&self) -> Vec<(ProtocolId, String, Vec<String>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn protocols(&self) -> Vec<(ProtocolId, String, Vec<String>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Return all connected peers’ protocols info
sourcepub fn ping_peers(&self)
pub fn ping_peers(&self)
Try ping all connected peers
sourcepub fn non_owning_clone(&self) -> Self
pub fn non_owning_clone(&self) -> Self
Since a non-owning reference does not count towards ownership, it will not prevent the value stored in the allocation from being dropped
Trait Implementations
sourceimpl Clone for NetworkController
impl Clone for NetworkController
sourcefn clone(&self) -> NetworkController
fn clone(&self) -> NetworkController
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
Auto Trait Implementations
impl !RefUnwindSafe for NetworkController
impl Send for NetworkController
impl Sync for NetworkController
impl Unpin for NetworkController
impl !UnwindSafe for NetworkController
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