From 176e5faf13c099f16440fb3c4db4bc29877bd02c Mon Sep 17 00:00:00 2001 From: eauxxs Date: Mon, 21 Oct 2024 17:39:07 +0800 Subject: [PATCH] clippy and change hop interval --- clash_lib/src/app/profile/mod.rs | 2 +- clash_lib/src/proxy/hysteria2/mod.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clash_lib/src/app/profile/mod.rs b/clash_lib/src/app/profile/mod.rs index 9d8a39a06..c458069bb 100644 --- a/clash_lib/src/app/profile/mod.rs +++ b/clash_lib/src/app/profile/mod.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, sync::Arc}; use serde::{Deserialize, Serialize}; -use tracing::{error, warn}; +use tracing::{error, trace, warn}; #[derive(Serialize, Deserialize, Debug, Clone)] struct Db { diff --git a/clash_lib/src/proxy/hysteria2/mod.rs b/clash_lib/src/proxy/hysteria2/mod.rs index 2674dcbf8..0f8b19897 100644 --- a/clash_lib/src/proxy/hysteria2/mod.rs +++ b/clash_lib/src/proxy/hysteria2/mod.rs @@ -184,7 +184,7 @@ impl ServerCertVerifier for CertVerifyOption { if let Some(ref cert) = self.certificate { if cert != end_entity { - return Err(rustls::Error::General(format!("cert mismatch",))); + return Err(rustls::Error::General("cert mismatch".to_string())); } else { return Ok(ServerCertVerified::assertion()); } @@ -269,7 +269,7 @@ impl Debug for Handler { impl Handler { const DEFAULT_MAX_IDLE_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(300); - const HOP_INTERVAL: std::time::Duration = std::time::Duration::from_secs(2); + const HOP_INTERVAL: std::time::Duration = std::time::Duration::from_secs(30); pub fn new(opts: HystOption) -> anyhow::Result { let verify = CertVerifyOption::new( @@ -380,6 +380,7 @@ impl Handler { ticker.tick().await; loop { select! { + // TODO if the connection has no stream, should not rebind _ = ticker.tick() => { let ep = ep.get().unwrap(); let udp = opts.get_udp_socket(&sess, ep.local_addr().unwrap().is_ipv6()).await?;