adding endpoint plugins

David Stainton dstainton415 at gmail.com
Wed Apr 30 13:42:30 UTC 2014


Greetings,

I wrote a simple IStreamClientEndpointStringParser for using the
SOCKS5ClientEndpoint with Tor:
https://gist.github.com/david415/26a4ed59078d2e27376f

I modified a txsocksx code example for testing the new endpoint descriptor:
https://gist.github.com/david415/7c6040117319cc3b0230

...but I am not sure how to "register" it such that calls to
clientFromString can return this endpoint when the descriptor prefix
matches.

This doc:
https://twistedmatrix.com/documents/13.2.0/api/twisted.internet.interfaces.IStreamClientEndpointStringParser.html
mentions placing the plugin in the twisted.plugins package... however this doc:
http://twistedsphinx.funsize.net/projects/core/howto/plugin.html
suggests that I can also set the PYTHONPATH to a directory:

"""if a directory which has been added to sys.path (typically by
adding it to the PYTHONPATH environment variable) contains a directory
named twisted/plugins/ , each .py file in that directory will be
loaded as a source of plugins."""

I'm using twisted 13.2.0 in a virtualenv... and I've tried setting
PYTHONPATH to a "twisted/plugins" directory no avail. I must be doing
something wrong here but after scouring the docs and twisted source
code... I'm just not sure.

This effort is part of solving for Tahoe-LAFS trac ticket 517:
"make tahoe Tor- and I2P-friendly"
https://tahoe-lafs.org/trac/tahoe-lafs/ticket/517

Thanks to Glyph and JP's help I was able to write a foolscap client
side patch to use twisted endpoints. See foolscap trac ticket 203:
http://foolscap.lothar.com/trac/ticket/203#comment:36

str4d has already written the foolscap server side endpoint patch...
Therefore it seems to me the next steps are to create parsers for
endpoints we are interested in supporting... and get Tahoe-LAFS to
register them so that serverFromString and clientFromString will
return the expected endpoint objects.

Cheers!

David


More information about the tahoe-dev mailing list