[−][src]Trait libp2p_core::topology::Topology
Storage for the network topology.
The topology should also store information about the local node, including its public key, its
PeerId
, and the addresses it's advertising.
Required methods
fn addresses_of_peer(&mut self, peer: &PeerId) -> Vec<Multiaddr>
Returns the addresses to try use to reach the given peer.
Note: Keep in mind that
peer
can be the local node.
fn local_peer_id(&self) -> &PeerId
Returns the PeerId
of the local node.
fn local_public_key(&self) -> &PublicKey
Returns the public key of the local node.
fn add_local_external_addrs<TIter>(&mut self, addrs: TIter) where
TIter: Iterator<Item = Multiaddr>,
TIter: Iterator<Item = Multiaddr>,
Adds an address that other nodes can use to connect to our local node.
Note: Should later be returned when calling
addresses_of_peer()
with thePeerId
of the local node.
Provided methods
fn set_connected(&mut self, _peer_id: &PeerId, _addr: &ConnectedPoint)
Indicates to the topology that we have successfully connected to the given address with the
given PeerId
.
fn set_disconnected(
&mut self,
_peer_id: &PeerId,
_addr: &ConnectedPoint,
_reason: DisconnectReason
)
&mut self,
_peer_id: &PeerId,
_addr: &ConnectedPoint,
_reason: DisconnectReason
)
Indicates to the topology that we have been disconnected from the given address with the
given PeerId
.
fn set_unreachable(&mut self, _addr: &Multiaddr)
Indicates to the topology that we have failed to reach the given address.
Implementors
impl Topology for MemoryTopology
[src]
impl Topology for MemoryTopology
fn addresses_of_peer(&mut self, peer: &PeerId) -> Vec<Multiaddr> | [src] |
fn add_local_external_addrs<TIter>(&mut self, addrs: TIter) where | [src] |
fn local_peer_id(&self) -> &PeerId | [src] |
fn local_public_key(&self) -> &PublicKey | [src] |
fn set_connected(&mut self, _peer_id: &PeerId, _addr: &ConnectedPoint) | [src] |
fn set_disconnected( | [src] |
fn set_unreachable(&mut self, _addr: &Multiaddr) | [src] |