mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
The listenOn is probably the most interesting part
This commit is contained in:
parent
7dbcb4d712
commit
fee8c55f01
@ -827,7 +827,7 @@ def _tub_portlocation(config, get_local_addresses_sync, allocate_tcp_port):
|
||||
return tubport, location
|
||||
|
||||
|
||||
def set_tub_locations(i2p_provider, tor_provider, tub, tubport, location):
|
||||
def tub_listen_on(i2p_provider, tor_provider, tub, tubport, location):
|
||||
"""
|
||||
Assign a Tub its listener locations.
|
||||
|
||||
@ -898,7 +898,7 @@ def create_main_tub(config, tub_options,
|
||||
log.msg("Tub is not listening")
|
||||
else:
|
||||
tubport, location = portlocation
|
||||
set_tub_locations(
|
||||
tub_listen_on(
|
||||
i2p_provider,
|
||||
tor_provider,
|
||||
tub,
|
||||
|
@ -40,7 +40,7 @@ from twisted.application import service
|
||||
from allmydata.node import (
|
||||
PortAssignmentRequired,
|
||||
PrivacyError,
|
||||
set_tub_locations,
|
||||
tub_listen_on,
|
||||
create_tub_options,
|
||||
create_main_tub,
|
||||
create_node_dir,
|
||||
@ -833,16 +833,16 @@ class Listeners(unittest.TestCase):
|
||||
(port1, port2))
|
||||
location = "tcp:localhost:%d,tcp:localhost:%d" % (port1, port2)
|
||||
t = FakeTub()
|
||||
set_tub_locations(None, None, t, port, location)
|
||||
tub_listen_on(None, None, t, port, location)
|
||||
self.assertEqual(t.listening_ports,
|
||||
["tcp:%d:interface=127.0.0.1" % port1,
|
||||
"tcp:%d:interface=127.0.0.1" % port2])
|
||||
|
||||
def test_tor_i2p_listeners(self):
|
||||
"""
|
||||
When configured to listen on an "i2p" or "tor" address,
|
||||
``set_tub_locations`` tells the Tub to listen on endpoints supplied by
|
||||
the given Tor and I2P providers.
|
||||
When configured to listen on an "i2p" or "tor" address, ``tub_listen_on``
|
||||
tells the Tub to listen on endpoints supplied by the given Tor and I2P
|
||||
providers.
|
||||
"""
|
||||
t = FakeTub()
|
||||
|
||||
@ -851,7 +851,7 @@ class Listeners(unittest.TestCase):
|
||||
tor_listener = object()
|
||||
tor_provider = ConstantAddresses(tor_listener)
|
||||
|
||||
set_tub_locations(
|
||||
tub_listen_on(
|
||||
i2p_provider,
|
||||
tor_provider,
|
||||
t,
|
||||
|
Loading…
Reference in New Issue
Block a user