From af6a8a3cb01024c12bfe9fa9bbc49372f0d331f4 Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Sun, 7 Apr 2024 19:02:57 +0800 Subject: [PATCH] minor changes --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c378a3d..71f8298 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -405,6 +405,8 @@ async fn handle_udp_associate_session( log::info!("Beginning {}", session_info); + // `_server` is meaningful here, it must be alive all the time + // to ensure that UDP transmission will not be interrupted accidentally. let (_server, udp_addr) = match udp_addr { Some(udp_addr) => (None, udp_addr), None => { @@ -567,6 +569,9 @@ async fn handle_dns_over_tcp_session( Ok(()) } +/// This function is used to handle the business logic of tun2proxy and SOCKS5 server. +/// When handling UDP proxy, the return value UDP associate IP address is the result of this business logic. +/// However, when handling TCP business logic, the return value Ok(None) is meaningless, just indicating that the operation was successful. async fn handle_proxy_session(server: &mut TcpStream, proxy_handler: Arc>) -> crate::Result> { let mut launched = false; let mut proxy_handler = proxy_handler.lock().await;