[Pkg-privacy-commits] [onioncircuits] 24/39: Allow specifying how to control Tor, via env vars.

Sascha Steinbiss sascha at steinbiss.name
Sun May 15 16:40:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch master
in repository onioncircuits.

commit d5ab13100c4ff7815b3c2e6d838d79cc5c4c0918
Author: anonym <anonym at riseup.net>
Date:   Thu May 12 12:31:34 2016 +0200

    Allow specifying how to control Tor, via 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.
---
 onioncircuits | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncircuits.git



More information about the Pkg-privacy-commits mailing list