From 391f6f3fb6c7d424cfcfc71731c2480429d906d2 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 22 Aug 2022 00:19:37 +0800 Subject: [PATCH] feat: update client --- src/client.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client.rs b/src/client.rs index 835f71a..788ee19 100644 --- a/src/client.rs +++ b/src/client.rs @@ -32,12 +32,13 @@ pub async fn run(listen_config: &ListenConfig) -> XResult<()> { } }); - information!("Start connect to server"); + information!("Start connect to server, proxy address: {}, with server name: {:?}", + listen_config.proxy_address, listen_config.proxy_server_name); let cert_pem = opt_result!(fs::read_to_string(&listen_config.cert_pem_file), "Read cert pem file: {}, failed: {}", &listen_config.cert_pem_file); let client = Client::builder() .with_tls(cert_pem.as_str())? - .with_io(listen_config.listen.as_str())? + .with_io("0.0.0.0:0")? .start()?; let addr: SocketAddr = listen_config.proxy_address.parse()?; let server_name = opt_value_result!(&listen_config.proxy_server_name, @@ -72,6 +73,7 @@ pub async fn run(listen_config: &ListenConfig) -> XResult<()> { } }; + information!("Get connection: {} - {}", client_stream_time, client_stream.peer_addr().unwrap()); let time = util_time::get_current_millis(); if (time as i128 - client_stream_time as i128).abs() > 3_000 { warning!("Connection is more than 3 second, abandon connection"); @@ -81,7 +83,7 @@ pub async fn run(listen_config: &ListenConfig) -> XResult<()> { let server_stream = match connection.open_bidirectional_stream().await { Ok(stream) => stream, Err(e) => { - failure!("Connect to server failed: {}", e); + failure!("Open stream in connection to server failed: {}", e); continue 're_connect; } };