aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/mod.rs')
-rw-r--r--src/transport/mod.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/transport/mod.rs b/src/transport/mod.rs
index d8c6e2b..fd3651b 100644
--- a/src/transport/mod.rs
+++ b/src/transport/mod.rs
@@ -34,6 +34,27 @@ compile_error!(
"continuum needs a transport: build with at least one of the mycelium, libp2p and tor features, e.g. `cargo build --features mycelium`"
);
+/// The options of the transports this build has, each checked by its transport when the
+/// configuration is loaded (`config::Settings::check`, after the names in `transports`):
+/// Mycelium's always (its conflicts are errors wherever they come from, as before);
+/// libp2p's and Tor's if the node uses them. Options of transports not built aren't
+/// checked: they're ignored, and said so (`config::Loaded::unused_transport_options`).
+pub(crate) fn check(settings: &crate::config::Settings) -> Result<()> {
+ let uses = |name: &str| settings.transports.iter().any(|used| used == name);
+ let _ = uses;
+ #[cfg(feature = "mycelium")]
+ mycelium::check(settings)?;
+ #[cfg(feature = "libp2p")]
+ if uses("libp2p") {
+ libp2p::check(settings)?;
+ }
+ #[cfg(feature = "tor")]
+ if uses("tor") {
+ tor::TorTransport::check(settings)?;
+ }
+ Ok(())
+}
+
/// Starts the transport `name` (one of `config::TRANSPORTS`) as `settings` configure
/// it: its scheme and the transport, or None if `stop` came first (some take a while to
/// start: a supervised Mycelium daemon, arti). `key`: the node key, which some prove