summaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/firewall.rs4
-rw-r--r--src/transport/identity.rs8
-rw-r--r--src/transport/mod.rs8
-rw-r--r--src/transport/traffic.rs4
4 files changed, 24 insertions, 0 deletions
diff --git a/src/transport/firewall.rs b/src/transport/firewall.rs
index e6816d6..78d00fc 100644
--- a/src/transport/firewall.rs
+++ b/src/transport/firewall.rs
@@ -92,6 +92,10 @@ impl Transport for FirewallTransport {
self.inner.discovered_seeds()
}
+ fn transports(&self) -> Vec<String> {
+ self.inner.transports()
+ }
+
async fn resolve_seed(&self, seed: &str) -> Result<String> {
self.inner.resolve_seed(seed).await
}
diff --git a/src/transport/identity.rs b/src/transport/identity.rs
index 04375f6..af0fe74 100644
--- a/src/transport/identity.rs
+++ b/src/transport/identity.rs
@@ -504,6 +504,14 @@ impl Transport for IdentityTransport {
self.shared.destination(peer).is_some()
}
+ fn transports(&self) -> Vec<String> {
+ self.shared
+ .links
+ .iter()
+ .map(|link| link.scheme.to_owned())
+ .collect()
+ }
+
/// Each transport's, with its scheme.
fn discovered_seeds(&self) -> Vec<String> {
self.shared
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index 6ae3814..3f77306 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -555,6 +555,14 @@ pub(crate) trait Transport: Send + Sync {
vec![peer.to_owned()]
}
+ /// The transports this node is on, as the schemes of their addresses
+ /// (`swarm::topology`), whether or not it has an address on each (one that only
+ /// connects out has none). By default the empty scheme, for a transport whose
+ /// identities are addresses.
+ fn transports(&self) -> Vec<String> {
+ vec![String::new()]
+ }
+
/// Seeds the transport found by itself since last asked (libp2p: nodes on the LAN),
/// for a node that is joining. By default none.
fn discovered_seeds(&self) -> Vec<String> {
diff --git a/src/transport/traffic.rs b/src/transport/traffic.rs
index 83b0cff..b332d3d 100644
--- a/src/transport/traffic.rs
+++ b/src/transport/traffic.rs
@@ -169,6 +169,10 @@ impl Transport for CountingTransport {
self.inner.discovered_seeds()
}
+ fn transports(&self) -> Vec<String> {
+ self.inner.transports()
+ }
+
async fn resolve_seed(&self, seed: &str) -> Result<String> {
self.inner.resolve_seed(seed).await
}