mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-29 15:29:49 +00:00
Merge PR394: pass I2P keyfile to foolscap
closes tahoe-lafs/tahoe-lafs#394
This commit is contained in:
commit
7453bdae84
@ -42,7 +42,8 @@ install_requires = [
|
|||||||
# * foolscap >= 0.12.3 provides tcp/tor/i2p connection handlers we need,
|
# * foolscap >= 0.12.3 provides tcp/tor/i2p connection handlers we need,
|
||||||
# and allocate_tcp_port
|
# and allocate_tcp_port
|
||||||
# * foolscap >= 0.12.5 has ConnectionInfo and ReconnectionInfo
|
# * foolscap >= 0.12.5 has ConnectionInfo and ReconnectionInfo
|
||||||
"foolscap >= 0.12.5",
|
# * foolscap >= 0.12.6 has an i2p.sam_endpoint() that takes kwargs
|
||||||
|
"foolscap >= 0.12.6",
|
||||||
|
|
||||||
# Needed for SFTP.
|
# Needed for SFTP.
|
||||||
# pycrypto 2.2 doesn't work due to <https://bugs.launchpad.net/pycrypto/+bug/620253>
|
# pycrypto 2.2 doesn't work due to <https://bugs.launchpad.net/pycrypto/+bug/620253>
|
||||||
|
@ -158,7 +158,7 @@ class I2P(unittest.TestCase):
|
|||||||
with mock.patch("foolscap.connections.i2p.default",
|
with mock.patch("foolscap.connections.i2p.default",
|
||||||
return_value=h1) as f:
|
return_value=h1) as f:
|
||||||
h = n._make_i2p_handler()
|
h = n._make_i2p_handler()
|
||||||
self.assertEqual(f.mock_calls, [mock.call(reactor)])
|
self.assertEqual(f.mock_calls, [mock.call(reactor, keyfile=None)])
|
||||||
self.assertIdentical(h, h1)
|
self.assertIdentical(h, h1)
|
||||||
|
|
||||||
def test_samport(self):
|
def test_samport(self):
|
||||||
|
@ -221,7 +221,7 @@ class Provider(unittest.TestCase):
|
|||||||
h = p.get_i2p_handler()
|
h = p.get_i2p_handler()
|
||||||
cfs.assert_called_with(reactor, "ep_desc")
|
cfs.assert_called_with(reactor, "ep_desc")
|
||||||
self.assertIs(h, handler)
|
self.assertIs(h, handler)
|
||||||
i2p.sam_endpoint.assert_called_with(ep)
|
i2p.sam_endpoint.assert_called_with(ep, keyfile=None)
|
||||||
|
|
||||||
def test_handler_launch(self):
|
def test_handler_launch(self):
|
||||||
i2p = mock.Mock()
|
i2p = mock.Mock()
|
||||||
@ -292,7 +292,7 @@ class Provider(unittest.TestCase):
|
|||||||
p = i2p_provider.Provider("basedir", FakeConfig(), reactor)
|
p = i2p_provider.Provider("basedir", FakeConfig(), reactor)
|
||||||
h = p.get_i2p_handler()
|
h = p.get_i2p_handler()
|
||||||
self.assertIs(h, handler)
|
self.assertIs(h, handler)
|
||||||
i2p.default.assert_called_with(reactor)
|
i2p.default.assert_called_with(reactor, keyfile=None)
|
||||||
|
|
||||||
class Provider_CheckI2PConfig(unittest.TestCase):
|
class Provider_CheckI2PConfig(unittest.TestCase):
|
||||||
def test_default(self):
|
def test_default(self):
|
||||||
|
@ -147,13 +147,14 @@ class Provider(service.MultiService):
|
|||||||
sam_port = self._get_i2p_config("sam.port", None)
|
sam_port = self._get_i2p_config("sam.port", None)
|
||||||
launch = self._get_i2p_config("launch", False, boolean=True)
|
launch = self._get_i2p_config("launch", False, boolean=True)
|
||||||
configdir = self._get_i2p_config("i2p.configdir", None)
|
configdir = self._get_i2p_config("i2p.configdir", None)
|
||||||
|
keyfile = self._get_i2p_config("dest.private_key_file", None)
|
||||||
|
|
||||||
if sam_port:
|
if sam_port:
|
||||||
if launch:
|
if launch:
|
||||||
raise ValueError("tahoe.cfg [i2p] must not set both "
|
raise ValueError("tahoe.cfg [i2p] must not set both "
|
||||||
"sam.port and launch")
|
"sam.port and launch")
|
||||||
ep = clientFromString(self._reactor, sam_port)
|
ep = clientFromString(self._reactor, sam_port)
|
||||||
return self._i2p.sam_endpoint(ep)
|
return self._i2p.sam_endpoint(ep, keyfile=keyfile)
|
||||||
|
|
||||||
if launch:
|
if launch:
|
||||||
executable = self._get_i2p_config("i2p.executable", None)
|
executable = self._get_i2p_config("i2p.executable", None)
|
||||||
@ -162,7 +163,7 @@ class Provider(service.MultiService):
|
|||||||
if configdir:
|
if configdir:
|
||||||
return self._i2p.local_i2p(configdir)
|
return self._i2p.local_i2p(configdir)
|
||||||
|
|
||||||
return self._i2p.default(self._reactor)
|
return self._i2p.default(self._reactor, keyfile=keyfile)
|
||||||
|
|
||||||
def check_dest_config(self):
|
def check_dest_config(self):
|
||||||
if self._get_i2p_config("dest", False, boolean=True):
|
if self._get_i2p_config("dest", False, boolean=True):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user