mirror of
https://github.com/Horizontal42/netsleuth.git
synced 2026-11-10 15:42:10 +03:00
actually stage the bgp_path.py half of the international-loop fix
This commit is contained in:
parent
938c715a04
commit
a21197f83b
1 changed files with 3 additions and 7 deletions
|
|
@ -62,12 +62,8 @@ def colo_location(code: str | None) -> tuple[str | None, str | None]:
|
||||||
return COLO_LOCATIONS.get(code.upper(), (None, None))
|
return COLO_LOCATIONS.get(code.upper(), (None, None))
|
||||||
|
|
||||||
|
|
||||||
def detect_international_loop(
|
def detect_international_loop(client_country: str | None, edge_country: str | None) -> tuple[bool, list[str]]:
|
||||||
client_country: str | None, ip_country: str | None, edge_country: str | None
|
if not client_country or not edge_country or edge_country == client_country:
|
||||||
) -> tuple[bool, list[str]]:
|
|
||||||
if not client_country or not ip_country or client_country != ip_country:
|
|
||||||
return False, []
|
|
||||||
if not edge_country or edge_country == client_country:
|
|
||||||
return False, []
|
return False, []
|
||||||
return True, [edge_country]
|
return True, [edge_country]
|
||||||
|
|
||||||
|
|
@ -79,7 +75,7 @@ def build_path_diversity(client_country: str | None, hops: list[AnycastHop]) ->
|
||||||
international_loop = False
|
international_loop = False
|
||||||
detour_countries: list[str] = []
|
detour_countries: list[str] = []
|
||||||
for hop in hops:
|
for hop in hops:
|
||||||
is_loop, countries = detect_international_loop(client_country, hop.ip_country, hop.edge_country)
|
is_loop, countries = detect_international_loop(client_country, hop.edge_country)
|
||||||
if is_loop:
|
if is_loop:
|
||||||
international_loop = True
|
international_loop = True
|
||||||
for country in countries:
|
for country in countries:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue