From 53c95d9860e8ad1560fa5ec616636f55a25fc4a9 Mon Sep 17 00:00:00 2001 From: EAimTY Date: Sat, 4 Feb 2023 17:03:52 +0900 Subject: [PATCH] deserde certs & priv_keys path as `PathBuf` --- tuic-client/src/config.rs | 7 ++++--- tuic-client/src/utils.rs | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tuic-client/src/config.rs b/tuic-client/src/config.rs index 8c2a0b6..14c4845 100644 --- a/tuic-client/src/config.rs +++ b/tuic-client/src/config.rs @@ -8,6 +8,7 @@ use std::{ fs::File, io::Error as IoError, net::{IpAddr, SocketAddr}, + path::PathBuf, str::FromStr, time::Duration, }; @@ -37,7 +38,7 @@ pub struct Relay { pub token: String, pub ip: Option, #[serde(default = "default::relay::certificates")] - pub certificates: Vec, + pub certificates: Vec, #[serde( default = "default::relay::udp_relay_mode", deserialize_with = "deserialize_from_str" @@ -111,9 +112,9 @@ impl Config { mod default { pub mod relay { use crate::utils::{CongestionControl, UdpRelayMode}; - use std::time::Duration; + use std::{path::PathBuf, time::Duration}; - pub fn certificates() -> Vec { + pub fn certificates() -> Vec { Vec::new() } diff --git a/tuic-client/src/utils.rs b/tuic-client/src/utils.rs index 752184a..e84a0cc 100644 --- a/tuic-client/src/utils.rs +++ b/tuic-client/src/utils.rs @@ -5,11 +5,12 @@ use std::{ fs::{self, File}, io::BufReader, net::{IpAddr, SocketAddr}, + path::PathBuf, str::FromStr, }; use tokio::net; -pub fn load_certs(paths: Vec, disable_native: bool) -> Result { +pub fn load_certs(paths: Vec, disable_native: bool) -> Result { let mut certs = RootCertStore::empty(); for path in &paths {