feat: update client
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user