Add method to query external addresses (#1022)

This commit is contained in:
Pierre Krieger 2019-03-28 15:58:02 -03:00 committed by GitHub
parent ebbe197d9c
commit 03ce6a6ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,6 +199,13 @@ where TBehaviour: NetworkBehaviour,
RawSwarm::listeners(&me.raw_swarm)
}
/// Returns an iterator that produces the list of addresses that other nodes can use to reach
/// us.
#[inline]
pub fn external_addresses(me: &Self) -> impl Iterator<Item = &Multiaddr> {
me.external_addrs.iter()
}
/// Returns the peer ID of the swarm passed as parameter.
#[inline]
pub fn local_peer_id(me: &Self) -> &PeerId {