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 {