Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#242 closed enhancement (fixed)

add SOCKS proxy handler to foolscap

Reported by: Brian Warner Owned by: Brian Warner
Priority: major Milestone: 0.12.1
Component: network Version: 0.7.0
Keywords: Cc: dstainton415@…

Description

Something like:

from foolscap.connection_plugins import SOCKSTCP

h = SOCKSTCP("tcp:localhost:9050")
tub.removeAllConnectionHintHandlers()
tub.addConnectionHintHandler(h)

You'd need to depend upon foolscap[socks] >= 0.9.1 to use this, and this would trigger a dependency on txsocksx.

It might also be nice to make the class accept a list of hint-prefixes to handle (defaulting to just "tcp:"), so that you could also use this to handle "tor:" hints. Before doing that, we should probably change the internals of hint processing to translate old-style "host:port" hints into "tcp:host:port", so that plugins don't need to do that themselves.

Change History (16)

comment:1 Changed 9 years ago by dawuud

ok... based on warner's tor branch i made this: https://github.com/david415/foolscap/tree/tor-client-plugin.0

it's a socks client plugin called TorPlugin? but we can rename it to SocksPlugin? or whatever.

comment:2 Changed 9 years ago by dawuud

Cc: dstainton415@… added

comment:3 Changed 9 years ago by dawuud

I added some unit tests for the tor/socks plugin: https://github.com/warner/foolscap/pull/21/files

comment:4 Changed 9 years ago by Brian Warner

Milestone: 0.10.00.11.0

the logging fixes (#244) take priority, pushing this out a release

comment:5 Changed 9 years ago by Brian Warner

Milestone: 0.11.00.12.0

Milestone renamed

comment:7 Changed 9 years ago by davidsarah

This was based off an older version of foolscap (0.6.5 IIRC), I rebased it to master here: https://github.com/daira/foolscap/tree/tor-client-plugin.2

comment:8 Changed 9 years ago by davidsarah

Owner: set to Brian Warner

comment:9 Changed 9 years ago by dawuud

Here's the latest after I merged upstream/master and manually resolved a conflict:

Version 0, edited 9 years ago by dawuud (next)

comment:10 Changed 9 years ago by dawuud

I received a code review from Brian Warner and I have tried to fix all the things he said to fix; although I have not yet rebased and squashed my messy commit history. We can continue to utilize this dev branch/pull request for code review until we consider it ready and then i'll squash and rebase it.

https://github.com/david415/foolscap/tree/tor-client-plugin.3 https://github.com/warner/foolscap/pull/25

comment:11 Changed 9 years ago by dawuud

i also made this dev branch with foolscap upstream master merged in: https://github.com/david415/foolscap/tree/tor-client-plugin.4

what's the next step to getting this ready to be merged?

comment:12 Changed 8 years ago by Brian Warner

I added a big list of recommended changes to the pull request

comment:13 Changed 8 years ago by Brian Warner

BTW, I'm going to change the API of IConnectionHintHandler.hint_to_endpoint to allow it to return a Deferred (that fires with a tuple of (endpoint, host)) instead of requiring it to return synchronously. This should make the #246 Tor handler easier to write (since it can try to connect/launch Tor before returning the endpoint). Feel free to take advantage of this in the SOCKS plugin, if it helps at all.

comment:14 Changed 8 years ago by Brian Warner

Milestone: 0.12.00.13.0

Moving these tickets from 0.12 to 0.13, since we need 0.12 out quickly to resolve #263

comment:15 Changed 8 years ago by Brian Warner

Resolution: fixed
Status: newclosed

Landed in [50762026].

comment:16 Changed 8 years ago by Brian Warner

Milestone: 0.13.00.12.1
Note: See TracTickets for help on using tickets.