summaryrefslogtreecommitdiffstats
path: root/src/transport/paths.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/paths.rs')
-rw-r--r--src/transport/paths.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/transport/paths.rs b/src/transport/paths.rs
index 2fe534a..3baa092 100644
--- a/src/transport/paths.rs
+++ b/src/transport/paths.rs
@@ -480,6 +480,19 @@ impl Paths {
.map(Link::own_address)
}
+ /// Relays listed for the swarm (`Transport::learn_relays`): to each transport the
+ /// addresses with its scheme, without it.
+ pub(crate) fn learn_relays(&self, addresses: &[String]) {
+ for link in &self.links {
+ let targets: Vec<String> = addresses
+ .iter()
+ .filter_map(|address| address.strip_prefix(link.scheme)?.strip_prefix(':'))
+ .map(str::to_owned)
+ .collect();
+ link.inner.learn_relays(&targets);
+ }
+ }
+
/// This node's own addresses, one per transport: `<scheme>:<its identity there>`.
pub(crate) fn own_addresses(&self) -> Vec<String> {
self.links.iter().map(Link::own_address).collect()