refactor: use strum on EncryptionAlgorithm, use Xor as default when AesGcm not available (#1923)

This commit is contained in:
Luna Yao
2026-03-25 11:42:34 +01:00
committed by GitHub
parent 1d89ddbb16
commit e2684a93de
14 changed files with 642 additions and 856 deletions
+6 -7
View File
@@ -10,10 +10,9 @@ use std::{
use crate::{
common::{
config::{
get_avaliable_encrypt_methods, load_config_from_file, process_secure_mode_cfg,
ConfigFileControl, ConfigLoader, ConsoleLoggerConfig, FileLoggerConfig,
LoggingConfigLoader, NetworkIdentity, PeerConfig, PortForwardConfig, TomlConfigLoader,
VpnPortalConfig,
load_config_from_file, process_secure_mode_cfg, ConfigFileControl, ConfigLoader,
ConsoleLoggerConfig, EncryptionAlgorithm, FileLoggerConfig, LoggingConfigLoader,
NetworkIdentity, PeerConfig, PortForwardConfig, TomlConfigLoader, VpnPortalConfig,
},
constants::EASYTIER_VERSION,
log,
@@ -277,9 +276,9 @@ struct NetworkOptions {
long,
env = "ET_ENCRYPTION_ALGORITHM",
help = t!("core_clap.encryption_algorithm").to_string(),
value_parser = get_avaliable_encrypt_methods()
value_enum,
)]
encryption_algorithm: Option<String>,
encryption_algorithm: Option<EncryptionAlgorithm>,
#[arg(
long,
@@ -1007,7 +1006,7 @@ impl NetworkOptions {
f.enable_encryption = !v;
}
if let Some(algorithm) = &self.encryption_algorithm {
f.encryption_algorithm = algorithm.clone();
f.encryption_algorithm = algorithm.to_string();
}
if let Some(v) = self.disable_ipv6 {
f.enable_ipv6 = !v;