From 03ce6a6ed53e3ac1ef4333f521d2591b523065ed Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 28 Mar 2019 15:58:02 -0300 Subject: [PATCH] Add method to query external addresses (#1022) --- core/src/swarm.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/swarm.rs b/core/src/swarm.rs index ea60dd69999..7a3e4be7224 100644 --- a/core/src/swarm.rs +++ b/core/src/swarm.rs @@ -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 { + me.external_addrs.iter() + } + /// Returns the peer ID of the swarm passed as parameter. #[inline] pub fn local_peer_id(me: &Self) -> &PeerId {