mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
fix bugs and improve user experiance (#86)
* correctly set mtu, and allow set mtu manually * communicate between enc and non-enc should not panic * allow loading cfg from file * allow change file log level dynamically
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::{
|
||||
net::SocketAddr,
|
||||
path::PathBuf,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
@@ -144,6 +145,8 @@ pub struct Flags {
|
||||
pub enable_encryption: bool,
|
||||
#[derivative(Default(value = "true"))]
|
||||
pub enable_ipv6: bool,
|
||||
#[derivative(Default(value = "1420"))]
|
||||
pub mtu: u16,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
||||
@@ -192,9 +195,9 @@ impl TomlConfigLoader {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new(config_path: &str) -> Result<Self, anyhow::Error> {
|
||||
pub fn new(config_path: &PathBuf) -> Result<Self, anyhow::Error> {
|
||||
let config_str = std::fs::read_to_string(config_path)
|
||||
.with_context(|| format!("failed to read config file: {}", config_path))?;
|
||||
.with_context(|| format!("failed to read config file: {:?}", config_path))?;
|
||||
Self::new_from_str(&config_str)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user