mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-12 20:57:26 +08:00
support encryption (#60)
This commit is contained in:
@@ -124,6 +124,14 @@ and the vpn client is in network of 10.14.14.0/24"
|
||||
#[arg(long, help = "default protocol to use when connecting to peers")]
|
||||
default_protocol: Option<String>,
|
||||
|
||||
#[arg(
|
||||
short = 'u',
|
||||
long,
|
||||
help = "disable encryption for peers communication, default is false, must be same with peers",
|
||||
default_value = "false"
|
||||
)]
|
||||
disable_encryption: bool,
|
||||
|
||||
#[arg(
|
||||
long,
|
||||
help = "use multi-thread runtime, default is single-thread",
|
||||
@@ -136,10 +144,10 @@ impl From<Cli> for TomlConfigLoader {
|
||||
fn from(cli: Cli) -> Self {
|
||||
let cfg = TomlConfigLoader::default();
|
||||
cfg.set_inst_name(cli.instance_name.clone());
|
||||
cfg.set_network_identity(NetworkIdentity {
|
||||
network_name: cli.network_name.clone(),
|
||||
network_secret: cli.network_secret.clone(),
|
||||
});
|
||||
cfg.set_network_identity(NetworkIdentity::new(
|
||||
cli.network_name.clone(),
|
||||
cli.network_secret.clone(),
|
||||
));
|
||||
|
||||
cfg.set_netns(cli.net_ns.clone());
|
||||
if let Some(ipv4) = &cli.ipv4 {
|
||||
@@ -254,11 +262,12 @@ impl From<Cli> for TomlConfigLoader {
|
||||
});
|
||||
}
|
||||
|
||||
let mut f = cfg.get_flags();
|
||||
if cli.default_protocol.is_some() {
|
||||
let mut f = cfg.get_flags();
|
||||
f.default_protocol = cli.default_protocol.as_ref().unwrap().clone();
|
||||
cfg.set_flags(f);
|
||||
}
|
||||
f.enable_encryption = !cli.disable_encryption;
|
||||
cfg.set_flags(f);
|
||||
|
||||
cfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user