From 1e943f511add4e177fbc5e7bc339444b8b09ad8a Mon Sep 17 00:00:00 2001
From: KillYourTV <killyourtv@i2pmail.org>
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
|
b
|
class Node(service.MultiService): |
185 | 185 | # N.B.: this is in seconds, so use "1800" to get 30min |
186 | 186 | self.tub.setOption("disconnectTimeout", int(disconnect_timeout_s)) |
187 | 187 | |
| 188 | outbound_proxy = self.get_config("node", "outbound_proxy", "") |
| 189 | if outbound_proxy: |
| 190 | self.tub.setOption("outbound-proxy", outbound_proxy) |
| 191 | |
188 | 192 | self.nodeid = b32decode(self.tub.tubID.upper()) # binary format |
189 | 193 | self.write_config("my_nodeid", b32encode(self.nodeid).lower() + "\n") |
190 | 194 | 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
|
b
|
def write_node_config(c, config): |
87 | 87 | webport = "" |
88 | 88 | c.write("web.port = %s\n" % (webport.encode('utf-8'),)) |
89 | 89 | c.write("web.static = public_html\n") |
| 90 | c.write("#outbound_proxy =\n") |
90 | 91 | c.write("#tub.port =\n") |
91 | 92 | c.write("#tub.location = \n") |
92 | 93 | 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
|
b
|
class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase): |
1786 | 1786 | d.addCallback(_run_in_subprocess, "put", "-", "newalias:tahoe-file", stdin=STDIN_DATA) |
1787 | 1787 | d.addCallback(_check_succeeded, check_stderr=False) |
1788 | 1788 | |
1789 | | def _mv_with_http_proxy(ign): |
| 1789 | def _mv_with_outbound_proxy(ign): |
1790 | 1790 | env = os.environ |
1791 | | env['http_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345" # invalid address |
| 1791 | env['outbound_proxy'] = env['HTTP_PROXY'] = "http://127.0.0.0:12345" # invalid address |
1792 | 1792 | return _run_in_subprocess(None, "mv", "newalias:tahoe-file", "newalias:tahoe-moved", env=env) |
1793 | | d.addCallback(_mv_with_http_proxy) |
| 1793 | d.addCallback(_mv_with_outbound_proxy) |
1794 | 1794 | d.addCallback(_check_succeeded) |
1795 | 1795 | |
1796 | 1796 | d.addCallback(_run_in_subprocess, "ls", "newalias:") |