Beyond the issues teratorn pointed out, there are a number of issues with the attached code:
- It uses Python 2.5 features; Twisted currently supports Python 2.3 and Python 2.4 as well.
- It doesn't really have any error handling; raising exceptions whenever a problem is encountered will lead to exceptions being logged and connections being dropped, and not call the right connection lost/failed callbacks.
- The code writes to standard out.
- The point of extension is very unclear. None of the existing mechanisms are used in this code to let applications take advantage of this functionality.
Taken all together, I think this suggests that the shape of the original SocksiPy code isn't really suitable as a base for something to be included in Twisted.
It would be great to have a good SOCKS client in Twisted, so I'm not closing this, but I am going to adjust it to reflect the real goal.
The original description was:
I made a port of SocksiPy http://socksipy.sourceforge.net/ for Twisted. AFAIK Twisted doesn't have a SOCKS client protocol yet, only server