1
0

deserde certs & priv_keys path as PathBuf

This commit is contained in:
EAimTY 2023-02-04 17:03:52 +09:00
parent f4dfa75e4c
commit 53c95d9860
2 changed files with 6 additions and 4 deletions

View File

@ -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<IpAddr>,
#[serde(default = "default::relay::certificates")]
pub certificates: Vec<String>,
pub certificates: Vec<PathBuf>,
#[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<String> {
pub fn certificates() -> Vec<PathBuf> {
Vec::new()
}

View File

@ -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<String>, disable_native: bool) -> Result<RootCertStore, Error> {
pub fn load_certs(paths: Vec<PathBuf>, disable_native: bool) -> Result<RootCertStore, Error> {
let mut certs = RootCertStore::empty();
for path in &paths {