Struct ckb_network::network::NetworkController[][src]

pub struct NetworkController { /* fields omitted */ }
Expand description

Network controller

Implementations

impl NetworkController[src]

pub fn public_urls(&self, max_urls: usize) -> Vec<(String, u8)>[src]

Node listen address list

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

ckb version

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

Node peer id’s base58 format string

pub fn add_node(&self, address: Multiaddr)[src]

Dial remote node

pub fn remove_node(&self, peer_id: &PeerId)[src]

Disconnect session with peer id

pub fn get_banned_addrs(&self) -> Vec<BannedAddr>[src]

Get banned peer list

pub fn clear_banned_addrs(&self)[src]

Clear banned list

pub fn addr_info(&self, addr: &Multiaddr) -> Option<AddrInfo>[src]

Get address info from peer store

pub fn ban(
    &self,
    address: IpNetwork,
    ban_until: u64,
    ban_reason: String
) -> Result<(), Error>
[src]

Ban an ip

pub fn unban(&self, address: &IpNetwork)[src]

Unban an ip

pub fn connected_peers(&self) -> Vec<(PeerIndex, Peer)>[src]

Return all connected peers’ information

pub fn ban_peer(
    &self,
    peer_index: PeerIndex,
    duration: Duration,
    reason: String
)
[src]

Ban an peer through peer index

pub fn broadcast(
    &self,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Broadcast a message to all connected peers

pub fn quick_broadcast(
    &self,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Broadcast a message to all connected peers through quick queue

pub fn send_message_to(
    &self,
    session_id: SessionId,
    proto_id: ProtocolId,
    data: Bytes
) -> Result<(), SendErrorKind>
[src]

Send message to one connected peer

pub fn is_active(&self) -> bool[src]

network message processing controller, always true, if false, discard any received messages

pub fn set_active(&self, active: bool)[src]

Change active status, if set false discard any received messages

pub fn protocols(&self) -> Vec<(ProtocolId, String, Vec<String>)>[src]

Return all connected peers’ protocols info

pub fn ping_peers(&self)[src]

Try ping all connected peers

Trait Implementations

impl Clone for NetworkController[src]

fn clone(&self) -> NetworkController[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Drop for NetworkController[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> AsAny for T where
    T: Any

pub fn as_any(&self) -> &(dyn Any + 'static)

TODO(doc): @quake

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V

impl<T> Erased for T