diff --git a/easytier/src/common/config.rs b/easytier/src/common/config.rs index dc5f1a0f..c2abe366 100644 --- a/easytier/src/common/config.rs +++ b/easytier/src/common/config.rs @@ -6,9 +6,9 @@ use std::{ }; use anyhow::Context; -use base64::{prelude::BASE64_STANDARD, Engine as _}; -use clap::builder::PossibleValue; +use base64::{Engine as _, prelude::BASE64_STANDARD}; use clap::ValueEnum; +use clap::builder::PossibleValue; use serde::{Deserialize, Serialize}; use strum::{Display, EnumString, VariantArray}; use tokio::io::AsyncReadExt as _; @@ -584,7 +584,12 @@ impl ConfigLoader for TomlConfigLoader { .filter(|h| !h.is_empty()); self.set_hostname(hostname.clone()); - hostname.unwrap_or_else(|| hostname::get().unwrap_or_default().to_string_lossy().into_owned()) + hostname.unwrap_or_else(|| { + hostname::get() + .unwrap_or_default() + .to_string_lossy() + .into_owned() + }) } fn set_hostname(&self, name: Option) { diff --git a/easytier/src/common/global_ctx.rs b/easytier/src/common/global_ctx.rs index d648c07d..a3cf4e5a 100644 --- a/easytier/src/common/global_ctx.rs +++ b/easytier/src/common/global_ctx.rs @@ -6,7 +6,7 @@ use sha2::Sha256; use socket2::Protocol; use std::sync::RwLock; use std::{ - collections::{hash_map::DefaultHasher, HashMap}, + collections::{HashMap, hash_map::DefaultHasher}, hash::Hasher, iter, net::{IpAddr, SocketAddr}, @@ -15,11 +15,11 @@ use std::{ }; use super::{ + PeerId, config::{ConfigLoader, Flags}, netns::NetNS, network::IPCollector, stun::{StunInfoCollector, StunInfoCollectorTrait}, - PeerId, }; #[cfg(feature = "magic-dns")] use crate::dns::{ diff --git a/easytier/src/dns/config/dns.rs b/easytier/src/dns/config/dns.rs index 702b3590..3d6a5f95 100644 --- a/easytier/src/dns/config/dns.rs +++ b/easytier/src/dns/config/dns.rs @@ -51,7 +51,12 @@ impl DnsConfig { impl DnsConfig { pub fn get_name(&self) -> LowerName { if self.name.is_empty() { - parse(hostname::get().unwrap_or_default().to_string_lossy().as_ref()) + parse( + hostname::get() + .unwrap_or_default() + .to_string_lossy() + .as_ref(), + ) } else { self.name.clone() } diff --git a/easytier/src/instance/proxy_cidrs_monitor.rs b/easytier/src/instance/proxy_cidrs_monitor.rs index 796e6093..26f14bfe 100644 --- a/easytier/src/instance/proxy_cidrs_monitor.rs +++ b/easytier/src/instance/proxy_cidrs_monitor.rs @@ -72,7 +72,7 @@ impl ProxyCidrsMonitor { pub fn start(self) -> ScopedTask<()> { ScopedTask::from(tokio::spawn(async move { let mut cur_proxy_cidrs = BTreeSet::new(); - // let last_update = None::; + // let mut last_update = None::; loop { tokio::time::sleep(std::time::Duration::from_secs(1)).await; diff --git a/easytier/src/web_client/mod.rs b/easytier/src/web_client/mod.rs index 9db012f3..50681478 100644 --- a/easytier/src/web_client/mod.rs +++ b/easytier/src/web_client/mod.rs @@ -225,7 +225,12 @@ pub async fn run_web_client( let mut flags = global_ctx.get_flags(); flags.bind_device = false; global_ctx.set_flags(flags); - let hostname = hostname.unwrap_or_else(|| hostname::get().unwrap_or_default().to_string_lossy().into_owned()); + let hostname = hostname.unwrap_or_else(|| { + hostname::get() + .unwrap_or_default() + .to_string_lossy() + .into_owned() + }); Ok(WebClient::new( create_connector_by_url(c_url.as_str(), &global_ctx, IpVersion::Both).await?, token.to_string(),