navigator/rules/map.starlark

31 lines
823 B
Plaintext
Raw Normal View History

WHOLESALE_INTERNET_10GE = "xe-mci1-us"
HETZNER_FSN_1GE = "ge-fsn1-de"
HETZNER_HEL_1GE = "ge-hel1-fi"
default_server = WHOLESALE_INTERNET_10GE
CHINA_MAINLAND_SUFFIX = ".eveedge.link"
GLOBAL_SUFFIX = ".edge.eve.network"
default_suffix = GLOBAL_SUFFIX
def getMapping(ip):
info = geoLookup(ip)
if not info:
return default_server + default_suffix
if info.IspDomain == "ChinaMobile":
return HETZNER_FSN_1GE + CHINA_MAINLAND_SUFFIX
if info.CountryCode == "CN":
return default_server + CHINA_MAINLAND_SUFFIX
return default_server + GLOBAL_SUFFIX
def getNodes():
return ["xe-mci1-us", "ge-fsn1-de", "ge-lax1-us"]
def getSuffix(ip):
info = geoLookup(ip)
if not info:
return default_suffix
if info.CountryCode == "CN":
return CHINA_MAINLAND_SUFFIX
return GLOBAL_SUFFIX