From ac76f52f6d363f73c5334b2c4afdb637f3a3a826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Sun, 7 Jan 2024 17:03:42 +0100 Subject: [PATCH] fix reverse socks5 proxy for udp association --- src/tunnel/server.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tunnel/server.rs b/src/tunnel/server.rs index 70600ab..4ba7c23 100644 --- a/src/tunnel/server.rs +++ b/src/tunnel/server.rs @@ -111,10 +111,11 @@ async fn run_tunnel( let local_srv = (Host::parse(&jwt.claims.r)?, jwt.claims.rp); let bind = format!("{}:{}", local_srv.0, local_srv.1); let listening_server = socks5::run_server(bind.parse()?, None); - let (tcp, local_srv) = run_listening_server(&local_srv, SERVERS.deref(), listening_server).await?; - let (local_rx, local_tx) = tokio::io::split(tcp); + let (stream, local_srv) = run_listening_server(&local_srv, SERVERS.deref(), listening_server).await?; + let proto = stream.local_protocol(); + let (local_rx, local_tx) = tokio::io::split(stream); - Ok((jwt.claims.p, local_srv.0, local_srv.1, Box::pin(local_rx), Box::pin(local_tx))) + Ok((proto, local_srv.0, local_srv.1, Box::pin(local_rx), Box::pin(local_tx))) } _ => Err(anyhow::anyhow!("Invalid upgrade request")), }