meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

unified Tor launcher/builder API #164

Closed meejah closed 7 years ago

meejah commented 8 years ago

After discussions with @warner (thanks!) I have been convinced that a "higher level" API that abstracts/represents "a running Tor" is a good idea. This instance would be returned from "connect to tor" or "launch a new tor" factory-functions, and give access to the TorControlProtocol instance.

On top of that, it acts as a Factory/Builder for other interesting instances: TorState, TorConfig, client- and server- side endpoints, etc.

There is an early prototype in the "control" branch: https://github.com/meejah/txtorcon/tree/controller

meejah commented 8 years ago

On the bikeshed-api-names/downside: ideally we'd just have something like txtorcon.launch() and txtorcon.connect() as "the" API that returns Tor instances, but there's already a txtorcon.launch_tor().

Probably the best path forward is to deprecate launch_tor() but leave it around for now (to avoid breaking existing code) and remove it one (major) version after launch() is introduced.

meejah commented 7 years ago

this is txtorcon.Tor in controller.py