diff options
| author | tv <tv@krebsco.de> | 2026-10-28 17:38:16 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-28 17:38:16 +0100 |
| commit | d7959009790a422ebb17d4c4ab1d9be3d48dc511 (patch) | |
| tree | e1409432709b0c856a05fb7fd0c0b31895878bcf /src/transport/paths.rs | |
| parent | 0c77de0d960de62f770a26204e0ef730d0a07b08 (diff) | |
list libp2p relays in document
Diffstat (limited to 'src/transport/paths.rs')
| -rw-r--r-- | src/transport/paths.rs | 13 |
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() |
