Skip to main content

NetworkView

Trait NetworkView 

pub trait NetworkView {
    // Required methods
    fn listening_as(&self) -> HashSet<Multiaddr>;
    fn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>;
    fn discovered_peers(&self) -> HashSet<PeerId>;
    fn connected_peers(&self) -> HashSet<PeerId>;
    fn is_connected(&self, peer: &PeerId) -> bool;
    fn health(&self) -> Health;
}
Expand description

Trait representing a read-only view of the network state.

Required Methods§

fn listening_as(&self) -> HashSet<Multiaddr>

Multiaddresses used for listening by the local node.

fn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>

Translation of the peer into its known multiaddresses.

fn discovered_peers(&self) -> HashSet<PeerId>

Peers collected by the network discovery mechanism.

fn connected_peers(&self) -> HashSet<PeerId>

Peers currently connected and tracked by the network.

fn is_connected(&self, peer: &PeerId) -> bool

Peers currently connected and tracked by the network.

fn health(&self) -> Health

Represents perceived health of the network.

Implementors§