Opened 9 years ago

Last modified 5 years ago

#1330 enhancement new

Socks V5 functionality

Reported by: jadestorm Owned by: jadestorm
Priority: lowest Milestone:
Component: core Keywords:
Cc: warner, jknight, jadestorm, khorn Branch:
Author: Launchpad Bug:


Attachments (2) (14.0 KB) - added by jadestorm 9 years ago. (1.4 KB) - added by jadestorm 9 years ago.

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by jadestorm

comment:1 Changed 9 years ago by jadestorm

One of my PyAIM/PyICQ users submitted this code and it works like a charm. 
Thought it might be nice to include in the main tree.  I only see Socks V4
support as it stands.  There are two files here, I'll attach the other one in a
second.  I imagine there's no good reason why the second ( file
couldn't be merged into, but hey.  Daniel Chandran
( submitted this code.  I offer it to Twisted proper
with his blessing.  =)

Changed 9 years ago by jadestorm

comment:2 Changed 9 years ago by jadestorm

Here's a quick example of using it; you'll note that there is a check for
whether socks is configured so that it's obvious what the difference between a
normal connection and a socks 5 based connection is:

        if self.socksProxyServer and self.socksProxyPort:
            c = protocol.ProxyClientCreator(reactor, serviceClasses[service],
self, cookie, d)
            c.connectSocks5Proxy(ip, 5190, self.socksProxyServer,
int(self.socksProxyPort), "BOSCONN").addCallback(addService)
            c = protocol.ClientCreator(reactor, serviceClasses[service], self,
cookie, d)       
            c.connectTCP(ip, 5190).addCallback(addService)

comment:3 Changed 8 years ago by jknight

This looks like a nice feature but it needs tests.

comment:4 Changed 6 years ago by exarkun

  • Component set to core
  • Owner set to glyph
  • Summary changed from [PATCH, sorta] Socks V5 functionality to Socks V5 functionality

comment:5 Changed 6 years ago by khorn

FYI, This looks like the same code from this email message:
except split into two files.

Assuming it is, the original author was Dmitry Litovchenko.

comment:6 follow-up: Changed 5 years ago by glyph

  • Owner changed from glyph to jadestorm
  • Priority changed from normal to lowest

This would need test coverage, and some kind of OK from Mr. Litovchenko if it were to be included.

comment:7 Changed 5 years ago by khorn

  • Cc khorn added

comment:8 Changed 5 years ago by khorn

There is some server-side SOCKSv5 code here:

It's MIT-licensed. Might be a good match with the client code?

comment:9 in reply to: ↑ 6 Changed 5 years ago by khorn

Replying to glyph:

This would need test coverage, and some kind of OK from Mr. Litovchenko if it were to be included.

Seeing as how Mr. Litovchenko sent it to the Twisted list with the apparent intention of contributing it, I think it's probably OK to include it.

Still does need tests though.

comment:10 Changed 5 years ago by khorn

I managed to track down Mr. Litovchenko. Here's the text of my email:


A number of years ago, you submitted some SOCKS5 client code to the Twisted python mailing list.  Here is the mail, in case you don't recall:

Some time later, a ticket was opened on the Twisted Trac instance which contained code very similar (possibly identical) to yours.  Here is that ticket:

In the interests of moving this ticket along, I have a few questions:

- Can you confirm that this code is in fact yours?
- Can you further confirm that it was your intention to have this code included in Twisted?
- Were you ever able to create any unit tests for this code?


Kevin Horn

and here's the text of his response:

1. Right, this looks like my old code just was split into 2 files + possibly some edits were made to it.
2. If you have intention to put it into Twisted codebase, go ahead, i'll be happy to know it finally made it in :)
3. No i think i didn't continue work on the module or unit tests, after it started doing that i needed from it.

So now this definitely just needs tests (and possibly to be updated to the current version of Twisted).

Note: See TracTickets for help on using tickets.