diff --git a/src/allmydata/introducer/common.py b/src/allmydata/introducer/common.py index 9c5638a36..699408ece 100644 --- a/src/allmydata/introducer/common.py +++ b/src/allmydata/introducer/common.py @@ -131,9 +131,9 @@ class AnnouncementDescriptor: .nickname: their self-provided nickname, or "" (unicode) .serverid: the server identifier. This is a pubkey (for V2 clients), or a tubid (for V1 clients). - .advertised_addresses: which hosts they listen on (list of strings) - if the announcement included a key for - 'anonymous-storage-FURL', else an empty list. + .connection_hints: where they listen (list of strings) if the + announcement included a key for + 'anonymous-storage-FURL', else an empty list. """ def __init__(self, when, index, canary, ann_d): @@ -148,6 +148,6 @@ class AnnouncementDescriptor: self.serverid = key_s or tubid_s furl = ann_d.get("anonymous-storage-FURL") if furl: - self.advertised_addresses = rrefutil.hosts_for_furl(furl) + self.connection_hints = rrefutil.connection_hints_for_furl(furl) else: - self.advertised_addresses = [] + self.connection_hints = [] diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py index 475b04dba..be7d05ddc 100644 --- a/src/allmydata/test/test_introducer.py +++ b/src/allmydata/test/test_introducer.py @@ -877,8 +877,8 @@ class SystemTest(SystemTestMixin, unittest.TestCase): class FakeRemoteReference: def notifyOnDisconnect(self, *args, **kwargs): pass def getRemoteTubID(self): return "62ubehyunnyhzs7r6vdonnm2hpi52w6y" - def getLocationHints(self): return [("ipv4", "here.example.com", "1234"), - ("ipv4", "there.example.com", "2345")] + def getLocationHints(self): return ["tcp:here.example.com:1234", + "tcp:there.example.com2345"] def getPeer(self): return address.IPv4Address("TCP", "remote.example.com", 3456) diff --git a/src/allmydata/util/rrefutil.py b/src/allmydata/util/rrefutil.py index b991267f1..6481cabc9 100644 --- a/src/allmydata/util/rrefutil.py +++ b/src/allmydata/util/rrefutil.py @@ -27,16 +27,18 @@ def trap_deadref(f): return trap_and_discard(f, DeadReferenceError) -def hosts_for_furl(furl, ignore_localhost=True): - advertised = [] - for hint in SturdyRef(furl).locationHints: - assert not isinstance(hint, str), hint - if hint[0] == "ipv4": - host = hint[1] - if ignore_localhost and host == "127.0.0.1": - continue - advertised.append(host) - return advertised +def connection_hints_for_furl(furl): + hints = [] + for h in SturdyRef(furl).locationHints: + # Foolscap-0.2.5 and earlier used strings in .locationHints, 0.2.6 + # through 0.6.4 used tuples of ("ipv4",host,port), 0.6.5 through + # 0.8.0 used tuples of ("tcp",host,port), and >=0.9.0 uses strings + # again. Tolerate them all. + if isinstance(h, tuple): + hints.append(":".join([str(s) for s in h])) + else: + hints.append(h) + return hints def stringify_remote_address(rref): remote = rref.getPeer() diff --git a/src/allmydata/web/introducer.xhtml b/src/allmydata/web/introducer.xhtml index 82c93764c..f64f7e092 100644 --- a/src/allmydata/web/introducer.xhtml +++ b/src/allmydata/web/introducer.xhtml @@ -30,7 +30,6 @@