From cde8421431219627b5f984cce7f91d8a10815060 Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Mon, 16 Mar 2026 20:22:11 -0400 Subject: [PATCH] Add connTimeout option --- src/socks5.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/socks5.js b/src/socks5.js index 0401f1c..33f64c8 100644 --- a/src/socks5.js +++ b/src/socks5.js @@ -371,6 +371,7 @@ class SocksServer { }); }, ); + const destinationInfo = { address: args.dst.addr, port: args.dst.port, @@ -431,6 +432,13 @@ class SocksServer { return end(RFC_1928_REPLIES.NETWORK_UNREACHABLE, args); }); + + if (self.options.connTimeout) { + destination.setTimeout(self.options.connTimeout); + destination.on('timeout', () => { + destination.destroy(); + }); + } }), ); } else {