From 5726df0b332c09521a5ef3cf398ee995396380bd Mon Sep 17 00:00:00 2001 From: Oryan Perlmutter Date: Tue, 21 Jan 2025 16:50:22 +0200 Subject: [PATCH 1/2] add .idea to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 15020d2..035c61e 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ MANIFEST /3proxy.conf /.cache/ /.env/ + +# IDE +.idea From eaa4d90c1b34ad93ae96d2709281171145c4d640 Mon Sep 17 00:00:00 2001 From: Oryan Perlmutter Date: Tue, 21 Jan 2025 18:31:30 +0200 Subject: [PATCH 2/2] Support udp sockets without proxying --- socks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/socks.py b/socks.py index 83b1435..4b5da8a 100644 --- a/socks.py +++ b/socks.py @@ -361,7 +361,9 @@ def bind(self, *pos, **kw): self.proxy_sockname = ("0.0.0.0", 0) # Unknown def sendto(self, bytes, *args, **kwargs): - if self.type != socket.SOCK_DGRAM: + proxy_type, addr, port, rdns, username, password = self.proxy + + if self.type != socket.SOCK_DGRAM or not proxy_type: return super(socksocket, self).sendto(bytes, *args, **kwargs) if not self._proxyconn: self.bind(("", 0)) @@ -387,7 +389,9 @@ def send(self, bytes, flags=0, **kwargs): return super(socksocket, self).send(bytes, flags, **kwargs) def recvfrom(self, bufsize, flags=0): - if self.type != socket.SOCK_DGRAM: + proxy_type, addr, port, rdns, username, password = self.proxy + + if self.type != socket.SOCK_DGRAM or not proxy_type: return super(socksocket, self).recvfrom(bufsize, flags) if not self._proxyconn: self.bind(("", 0))