We don't support old Foolscap versions anymore.

This commit is contained in:
Itamar Turner-Trauring 2021-04-01 10:19:16 -04:00
parent f606420d78
commit 9f02de688c
2 changed files with 4 additions and 15 deletions

View File

@ -11,9 +11,11 @@ if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
import re
from foolscap.api import SturdyRef
from allmydata.crypto.util import remove_prefix
from allmydata.crypto import ed25519
from allmydata.util import base32, rrefutil, jsonbytes as json
from allmydata.util import base32, jsonbytes as json
def get_tubid_string_from_ann(ann):
@ -127,6 +129,6 @@ class AnnouncementDescriptor(object):
self.serverid = key_s
furl = ann_d.get("anonymous-storage-FURL")
if furl:
self.connection_hints = rrefutil.connection_hints_for_furl(furl)
self.connection_hints = list(SturdyRef(furl).locationHints)
else:
self.connection_hints = []

View File

@ -20,19 +20,6 @@ def add_version_to_remote_reference(rref, default):
return d
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()
if isinstance(remote, address.IPv4Address):