From 1e943f511add4e177fbc5e7bc339444b8b09ad8a Mon Sep 17 00:00:00 2001 From: KillYourTV Date: Wed, 7 Aug 2013 15:00:23 +0000 Subject: [PATCH 1/2] outbound proxy support --- src/allmydata/node.py | 4 ++++ src/allmydata/scripts/create_node.py | 1 + src/allmydata/test/test_system.py | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/allmydata/node.py b/src/allmydata/node.py index 8873e5c..5792fd4 100644 --- a/src/allmydata/node.py +++ b/src/allmydata/node.py @@ -185,6 +185,10 @@ class Node(service.MultiService): # N.B.: this is in seconds, so use "1800" to get 30min self.tub.setOption("disconnectTimeout", int(disconnect_timeout_s)) + outbound_proxy = self.get_config("node", "outbound_proxy", "") + if outbound_proxy: + self.tub.setOption("outbound-proxy", outbound_proxy) + self.nodeid = b32decode(self.tub.tubID.upper()) # binary format self.write_config("my_nodeid", b32encode(self.nodeid).lower() + "\n") self.short_nodeid = b32encode(self.nodeid).lower()[:8] # ready for printing diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py index a27ed82..547f9aa 100644 --- a/src/allmydata/scripts/create_node.py +++ b/src/allmydata/scripts/create_node.py @@ -87,6 +87,7 @@ def write_node_config(c, config): webport = "" c.write("web.port = %s\n" % (webport.encode('utf-8'),)) c.write("web.static = public_html\n") + c.write("#outbound_proxy =\n") c.write("#tub.port =\n") c.write("#tub.location = \n") c.write("#log_gatherer.furl =\n") diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 56abc24..346302b 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -1786,11 +1786,11 @@ class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): d.addCallback(_run_in_subprocess, "put", "-", "newalias:tahoe-file", stdin=STDIN_DATA) d.addCallback(_check_succeeded, check_stderr=False) - def _mv_with_http_proxy(ign): + def _mv_with_outbound_proxy(ign): env = os.environ - env['http_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345" # invalid address + env['outbound_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345" # invalid address return _run_in_subprocess(None, "mv", "newalias:tahoe-file", "newalias:tahoe-moved", env=env) - d.addCallback(_mv_with_http_proxy) + d.addCallback(_mv_with_outbound_proxy) d.addCallback(_check_succeeded) d.addCallback(_run_in_subprocess, "ls", "newalias:") -- 1.7.10.4