[tor-dev] TorCtl Deprecation and Stem Plans

Damian Johnson atagar at torproject.org
Tue Jan 1 00:48:32 UTC 2013


> One thing I used the old controller library for is:
>
> - Create a bunch of circuits, possibly using Tor's default circuit
>   creation algorithm, but usually by specifying an explicit list of ORs.

Here's the parts of the Controller class that you'll want...

* get_circuit - provides an active circuit
* get_circuits - provides a list of active circuits
* new_circuit - create new circuits
* extend_circuit - create new circuits and extend existing ones
* repurpose_circuit - change a circuit's purpose
* close_circuit - close a circuit

See the following and the methods below it...
https://stem.torproject.org/api/control.html#stem.control.Controller.get_circuit

> - When a new stream is created, attach it to a (cleverly selected)
>   circuit.

See the attach_stream() method...
https://stem.torproject.org/api/control.html#stem.control.Controller.attach_stream

You'll want to call...

* controller.set_conf('__LeaveStreamsUnattached', '1')
* controller.new_circuit(await_build = True)
* attach your streams

Ideally we'd have a tutorial giving sample code for this (probably
fits with https://trac.torproject.org/7505).

Cheers! -Damian


More information about the tor-dev mailing list