diff --git a/vnt-cli/src/main.rs b/vnt-cli/src/main.rs index 26d12b6..ea7adba 100644 --- a/vnt-cli/src/main.rs +++ b/vnt-cli/src/main.rs @@ -214,10 +214,16 @@ fn main() { return; } - let cipher_model = matches - .opt_get::("model") - .unwrap() - .unwrap_or(CipherModel::AesGcm); + let cipher_model = match matches + .opt_get::("model") { + Ok(model) => { + model.unwrap_or(CipherModel::AesGcm) + } + Err(e) => { + println!("'--model ' invalid,{}", e); + return; + } + }; let finger = matches.opt_present("finger"); let punch_model = matches @@ -250,6 +256,7 @@ fn main() { main0(config, !unused_cmd); std::process::exit(0); } + #[tokio::main] async fn main0(config: Config, show_cmd: bool) { let server_encrypt = config.server_encrypt; diff --git a/vnt/src/cipher/cipher.rs b/vnt/src/cipher/cipher.rs index 5dd4840..9998300 100644 --- a/vnt/src/cipher/cipher.rs +++ b/vnt/src/cipher/cipher.rs @@ -28,7 +28,7 @@ impl FromStr for CipherModel { "aes_gcm" => Ok(CipherModel::AesGcm), "aes_cbc" => Ok(CipherModel::AesCbc), "aes_ecb" => Ok(CipherModel::AesEcb), - _ => Err(format!("not match '{}'", s)), + _ => Err(format!("not match '{}', enum:aes_gcm/aes_cbc/aes_ecb", s)), } } }