r/pythonhelp • • 4d ago

python socks5 proxy server lib

is there library wich handless socks5 protocol for me and allows me to decide tru wich socks5 proxy to route each connection and to wich ip wich domain to resolve by giving it functions wich it calls when need to connect/resolve domain tru my proxy

example function that it gives(its not fully python syntax since python typing system is hard to read):

    run(
      ip,port,user,pass,
      resolve(domain)->ip, #called when client tryes to resolve domain and return ip it will get 
      connect(ip)->(ip,port,user,pass) #called when client wants to connect to specific ip and returns ip,port,user,pass of socks5 proxy tru wich it will connect,if user and pass is None connects without them
    )
2 Upvotes

3 comments sorted by

•

u/AutoModerator 4d ago

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/RyanDubois43 4d ago

PySocks only handles client-side, not server, so you want PySocks for connecting but not for building a custom socks5 server. For server with hooks like that, look at python-socks5-server and subclass Socks5ServerHandler to override connect and resolve logic.

0

u/PinAdorable3380 4d ago

its a proxy server library for pythonnn