mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-12 12:47:25 +08:00
fix log dir not work; fix stun config from file not work; (#1393)
This commit is contained in:
@@ -968,8 +968,17 @@ impl NetworkOptions {
|
||||
old_udp_whitelist.extend(self.udp_whitelist.clone());
|
||||
cfg.set_udp_whitelist(old_udp_whitelist);
|
||||
|
||||
cfg.set_stun_servers(self.stun_servers.clone());
|
||||
cfg.set_stun_servers_v6(self.stun_servers_v6.clone());
|
||||
if let Some(stun_servers) = &self.stun_servers {
|
||||
let mut old_stun_servers = cfg.get_stun_servers().unwrap_or_default();
|
||||
old_stun_servers.extend(stun_servers.iter().cloned());
|
||||
cfg.set_stun_servers(Some(old_stun_servers));
|
||||
}
|
||||
|
||||
if let Some(stun_servers_v6) = &self.stun_servers_v6 {
|
||||
let mut old_stun_servers_v6 = cfg.get_stun_servers_v6().unwrap_or_default();
|
||||
old_stun_servers_v6.extend(stun_servers_v6.iter().cloned());
|
||||
cfg.set_stun_servers_v6(Some(old_stun_servers_v6));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,14 @@ pub fn init_logger(
|
||||
});
|
||||
}
|
||||
|
||||
let dir = file_config.dir.as_deref().unwrap_or(".");
|
||||
let file = file_config.file.as_deref().unwrap_or("easytier.log");
|
||||
let path = std::path::Path::new(dir).join(file);
|
||||
let path_str = path.to_string_lossy().into_owned();
|
||||
|
||||
let builder = RollingFileAppenderBase::builder();
|
||||
let file_appender = builder
|
||||
.filename(file_config.file.unwrap_or("easytier.log".to_string()))
|
||||
.filename(path_str)
|
||||
.condition_daily()
|
||||
.max_filecount(file_config.count.unwrap_or(10))
|
||||
.condition_max_file_size(file_config.size_mb.unwrap_or(100) * 1024 * 1024)
|
||||
|
||||
Reference in New Issue
Block a user