Allow multiple or none addres ranges for vertices

styling
LEdoian 1 year ago
parent 18b695462d
commit 7cf33d0fa2

@ -173,7 +173,7 @@ class VertexID:
# enumeration, but socket does, so we use that (AF_INET, AF_INET6). Routers
# can omit the family, since the router ID is family-agnostic, and it also
# could be unknown for transit networks.
family: AddressFamily
family: AddressFamily | None
# We do _not_ use NodeType, because what is an extra-area network in one
# topology might become a transit network in another. So we only distinguish routers and networks.
@ -183,7 +183,7 @@ class VertexID:
# include all the possible elements here and set them to None when not
# applicable.
address: IPv4Network | IPv6Network | None
address: IPv4Network | IPv6Network | tuple[IPv4Network | IPv6Network] | None
router_id: int | None
# For discriminating networks
dr_id: int | None
@ -257,7 +257,7 @@ class VertexFinder:
# All of the following dictionaries have scalars as keys and sets of VertexIDs as value.
# If there were multiple addresses, they were added individually.
self.by_addr: dict[IPv4Network | IPv6Network, set[VertexID]] = defaultdict(lambda: set())
self.by_addr: dict[IPv4Network | IPv6Network | None, set[VertexID]] = defaultdict(lambda: set())
self.by_rid = defaultdict(lambda: set())
self.by_dr = defaultdict(lambda: set())
self.by_discriminator = defaultdict(lambda: set())

Loading…
Cancel
Save