Add more configuration tests

This commit is contained in:
2022-09-02 15:01:34 +02:00
parent a5e48cf9d0
commit 59aadeacd4
12 changed files with 463 additions and 97 deletions

View File

@ -7,7 +7,7 @@ use std::sync::Arc;
use futures::future::join_all;
use reqwest::{Certificate, Identity};
use crate::base::err_utils::new_err;
use crate::base::err_utils::{encpasulate_error, new_err};
use crate::base::RemoteConfig;
use crate::tcp_relay_client::client_config::ClientConfig;
use crate::tcp_relay_client::relay_client::relay_client;
@ -29,7 +29,8 @@ async fn get_server_config(conf: &ClientConfig) -> Result<RemoteConfig, Box<dyn
// Specify client certificate, if any
if let Some(kp) = conf.get_merged_client_keypair() {
let identity = Identity::from_pem(&kp).expect("Failed to load certificates for reqwest!");
let identity = Identity::from_pem(&kp)
.map_err(|e| encpasulate_error(e, "Failed to load certificates for reqwest!"))?;
client = client.identity(identity).use_rustls_tls();
}
@ -93,7 +94,7 @@ pub async fn run_app(mut args: ClientConfig) -> std::io::Result<()> {
port.id,
urlencoding::encode(args.get_auth_token())
)
.replace("http", "ws"),
.replace("http", "ws"),
listen_address,
args.clone(),
));