Anorov / PySocks

A SOCKS proxy client and wrapper for Python.
Other
1.23k stars 260 forks source link

[question] I need to use direct connection on one port #111

Open plavcik opened 6 years ago

plavcik commented 6 years ago

I'm using PySocks==1.6.8 in Python 3.6.4

socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 8888)                      
socket.socket = socks.socksocket                                                 
socket.setdefaulttimeout(timeout)

I need for connection to PostgreSQL (via asyncpg.create_pool) on port 5432 ignore proxy and go directly. Is that possible and how?

fox0 commented 5 years ago
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 8888)                      
orig_socket = socket.socket
socket.socket = socks.socksocket                                                 
socket.setdefaulttimeout(timeout)

s = orig_socket() #…