[Pkg-privacy-commits] [torbrowser-launcher] 09/10: make socks4 port configurable. (Closes: #797339)

Holger Levsen holger at moszumanska.debian.org
Thu Mar 3 14:38:41 UTC 2016


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

holger pushed a commit to branch master
in repository torbrowser-launcher.

commit a34eacfb06a778a36e5a94cbbfc5f5ac13d67d30
Author: Holger Levsen <holger at layer-acht.org>
Date:   Tue Mar 1 13:08:39 2016 +0100

    make socks4 port configurable. (Closes: #797339)
    
    Thanks to Michael Gold <michael at bitplane.org> for the original patch
---
 torbrowser_launcher/common.py   |  1 +
 torbrowser_launcher/launcher.py |  4 ++--
 torbrowser_launcher/settings.py | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/torbrowser_launcher/common.py b/torbrowser_launcher/common.py
index 1eddb54..531067d 100644
--- a/torbrowser_launcher/common.py
+++ b/torbrowser_launcher/common.py
@@ -194,6 +194,7 @@ class Common:
             'installed': False,
             'download_over_tor': False,
             'modem_sound': False,
+            'tor_socks_address': 'tcp:127.0.0.1:9050',
             'mirror': self.default_mirror
         }
 
diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py
index 9815e84..e32f2db 100644
--- a/torbrowser_launcher/launcher.py
+++ b/torbrowser_launcher/launcher.py
@@ -386,10 +386,10 @@ class Launcher:
         self.refresh_gtk()
 
         if self.common.settings['download_over_tor']:
-            from twisted.internet.endpoints import TCP4ClientEndpoint
+            from twisted.internet.endpoints import clientFromString
             from txsocksx.http import SOCKS5Agent
 
-            torEndpoint = TCP4ClientEndpoint(reactor, '127.0.0.1', 9050)
+            torEndpoint = clientFromString(reactor, self.common.settings['tor_socks_address'])
 
             # default mirror gets certificate pinning, only for requests that use the mirror
             agent = SOCKS5Agent(reactor, proxyEndpoint=torEndpoint)
diff --git a/torbrowser_launcher/settings.py b/torbrowser_launcher/settings.py
index 57b8e32..7c782df 100644
--- a/torbrowser_launcher/settings.py
+++ b/torbrowser_launcher/settings.py
@@ -101,6 +101,21 @@ class Settings:
             self.modem_checkbox.set_tooltip_text(_("This option requires python-pygame to be installed"))
         self.modem_checkbox.show()
 
+        # Tor SOCKS address
+        self.tor_addr_box = gtk.HBox(False, 10)
+        self.settings_box.pack_start(self.tor_addr_box, True, True, 0)
+        self.tor_addr_box.show()
+
+        self.tor_addr_label = gtk.Label(_('Tor server'))
+        self.tor_addr_label.set_line_wrap(True)
+        self.tor_addr_box.pack_start(self.tor_addr_label, True, True, 0)
+        self.tor_addr_label.show()
+
+        self.tor_addr = gtk.Entry()
+        self.tor_addr.set_text(self.common.settings['tor_socks_address'])
+        self.tor_addr_box.pack_start(self.tor_addr, True, True, 0)
+        self.tor_addr.show()
+
         # status
         if(self.common.settings['installed']):
             self.status_label = gtk.Label(_('Status: Installed'))
@@ -212,6 +227,7 @@ class Settings:
         # checkbox options
         self.common.settings['download_over_tor'] = self.tor_download_checkbox.get_active()
         self.common.settings['modem_sound'] = self.modem_checkbox.get_active()
+        self.common.settings['tor_socks_address'] = self.tor_addr.get_text()
 
         # figure out the selected mirror
         self.common.settings['mirror'] = self.common.mirrors[self.mirrors.get_active()]

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



More information about the Pkg-privacy-commits mailing list