summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-05-12 12:31:34 +0200
committeranonym <anonym@riseup.net>2016-05-12 12:38:30 +0200
commitd5ab13100c4ff7815b3c2e6d838d79cc5c4c0918 (patch)
treee958fddde7698902db50109846b3772687febabe
parent64d3e7a15619e29d3508c99f740ac6cb8ec802f4 (diff)
Allow specifying how to control Tor, via env vars.feature/11402-control-env-vars
* TOR_CONTROL_SOCKET is a path to the control socket file. * TOR_CONTROL_ADDRESS is the IPv4 address and TOR_CONTROL_PORT is the port of the control *port*. If only one of these are specified, a sane default will be picked for the other. By default sane defaults are set for all three of these, so this is only a mechanism to override them for non-standard configurations. Both the socket file and port will be tried, in that order.
-rwxr-xr-xonioncircuits11
1 files changed, 10 insertions, 1 deletions
diff --git a/onioncircuits b/onioncircuits
index c702e72..0b46386 100755
--- a/onioncircuits
+++ b/onioncircuits
@@ -641,7 +641,16 @@ class OnionCircuitsApplication(Gtk.Application):
def connect_controller(self):
"""Connects the controller to the Tor daemon.
"""
- self.controller = stem.connection.connect_socket_file()
+ connect_args = dict()
+ if 'TOR_CONTROL_SOCKET' in os.environ:
+ connect_args['control_socket'] = os.environ.get('TOR_CONTROL_SOCKET')
+ if 'TOR_CONTROL_ADDRESS' in os.environ or \
+ 'TOR_CONTROL_PORT' in os.environ:
+ connect_args['control_port'] = (
+ os.environ.get('TOR_CONTROL_ADDRESS', '127.0.0.1'),
+ int(os.environ.get('TOR_CONTROL_PORT', 9051))
+ )
+ self.controller = stem.connection.connect(**connect_args)
return self.controller
def do_activate(self):