diff --git a/src/cli.rs b/src/cli.rs index e8ad500..4988c65 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -80,6 +80,10 @@ pub struct StartArgs { /// Log Level to print [off, trace, debug, error, warn, info] #[clap(short = 'l', long = "log-level", value_name = "LEVEL")] pub log_level: Option, + + /// Don't configure the ZeroTier network's dns servers and domain. Default: False + #[clap(long = "no-configure-network")] + pub no_configure_network: bool, } impl Into for StartArgs { @@ -109,6 +113,7 @@ impl Into for StartArgs { log_level: self.log_level, network_id: Some(self.network_id), local_url: self.local_url, + no_configure_network: self.no_configure_network, } } } diff --git a/src/init.rs b/src/init.rs index 70fe5fa..308fae3 100644 --- a/src/init.rs +++ b/src/init.rs @@ -34,6 +34,8 @@ pub struct Launcher { pub local_url: String, #[serde(skip_deserializing)] pub network_id: Option, + #[serde(default = "bool::default")] + pub no_configure_network: bool, } #[derive(Debug, Clone, Serialize, PartialEq)] @@ -72,6 +74,7 @@ impl Default for Launcher { network_id: None, log_level: None, local_url: ZEROTIER_LOCAL_URL.to_string(), + no_configure_network: false, } } } @@ -122,15 +125,17 @@ impl Launcher { // more or less the setup for the "main loop" if !ips.is_empty() { - update_central_dns( - domain_name.clone(), - ips.iter() - .map(|i| parse_ip_from_cidr(i.clone()).to_string()) - .collect(), - client.clone(), - self.network_id.clone().unwrap(), - ) - .await?; + if !self.no_configure_network { + update_central_dns( + domain_name.clone(), + ips.iter() + .map(|i| parse_ip_from_cidr(i.clone()).to_string()) + .collect(), + client.clone(), + self.network_id.clone().unwrap(), + ) + .await?; + } let mut listen_ips = Vec::new(); let mut ipmap = HashMap::new();