Support comma-separated multi-location hints.

This commit is contained in:
Itamar Turner-Trauring 2022-08-15 10:08:50 -04:00
parent 8b3280bf31
commit 71b7e9b643

View File

@ -14,6 +14,8 @@ the configuration process.
from __future__ import annotations from __future__ import annotations
from itertools import chain
from twisted.internet.protocol import Protocol from twisted.internet.protocol import Protocol
from twisted.internet.interfaces import IDelayedCall from twisted.internet.interfaces import IDelayedCall
from twisted.internet.ssl import CertificateOptions from twisted.internet.ssl import CertificateOptions
@ -94,7 +96,11 @@ class _FoolscapOrHttps(Protocol, metaclass=_PretendToBeNegotiation):
) )
storage_nurls = set() storage_nurls = set()
for location_hint in cls.tub.locationHints: # Individual hints can be in the form
# "tcp:host:port,tcp:host:port,tcp:host:port".
for location_hint in chain.from_iterable(
hints.split(",") for hints in cls.tub.locationHints
):
if location_hint.startswith("tcp:"): if location_hint.startswith("tcp:"):
_, hostname, port = location_hint.split(":") _, hostname, port = location_hint.split(":")
port = int(port) port = int(port)