From d5b76c18cc05bb14e481b383bcc48a60c58f042a Mon Sep 17 00:00:00 2001 From: "B. Blechschmidt" Date: Sun, 20 Aug 2023 17:27:22 +0200 Subject: [PATCH] Fix UDP associate address --- src/socks.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/socks.rs b/src/socks.rs index 4dbc091..9d61f47 100644 --- a/src/socks.rs +++ b/src/socks.rs @@ -203,7 +203,13 @@ impl SocksProxyImpl { } fn send_request_socks5(&mut self) -> Result<(), Error> { - protocol::Request::new(self.command, self.info.dst.clone()).write_to_stream(&mut self.server_outbuf)?; + use socks5_impl::protocol::Command::UdpAssociate; + let addr = if self.command == UdpAssociate { + Address::unspecified() + } else { + self.info.dst.clone() + }; + protocol::Request::new(self.command, addr).write_to_stream(&mut self.server_outbuf)?; self.state = SocksState::ReceiveResponse; self.state_change() }