diff --git foolscap/referenceable.py foolscap/referenceable.py index 7efbcb5..c15d706 100644 --- foolscap/referenceable.py +++ foolscap/referenceable.py @@ -763,6 +763,8 @@ AUTH_STURDYREF_RE = re.compile(r"pb://([^@]+)@([^/]+)/(.+)$") NONAUTH_STURDYREF_RE = re.compile(r"pbu://([^/]+)/(.+)$") IPV4_HINT_RE = re.compile(r"^([^:]+):(\d+)$") +# I2P: Recognize I2P destinations +I2P_HINT_RE = re.compile(r"^([a-z2-7]{52}\.b32\.i2p)$") def encode_location_hint(hint): assert hint[0] == "ipv4" host, port = hint[1:] @@ -775,8 +777,14 @@ def decode_location_hints(hints_s): hint = ( "ipv4", mo.group(1), int(mo.group(2)) ) hints.append(hint) else: - # some extension from the future that we will ignore - pass + mo = I2P_HINT_RE.search(hint_s) + if mo: + # I2P: destinations have no port + hint = ( "ipv4", mo.group(1), 0) + hints.append(hint) + else: + # some extension from the future that we will ignore + pass return hints class BadFURLError(Exception):