navigator/rules/map.starlark

42 lines
1.0 KiB
Plaintext
Raw Normal View History

WHOLESALE_INTERNET_10GE = "xe-mci1-us"
HETZNER_FSN_1GE = "ge-fsn1-de"
HETZNER_HEL_1GE = "ge-hel1-fi"
CLOUDCONE_LAX1_1GE = "ge-lax1-us"
CLOUDCONE_LAX2_1GE = "ge-lax2-us"
CLOUDCONE_LAX_LB = (CLOUDCONE_LAX1_1GE, CLOUDCONE_LAX2_1GE)
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
if info.IspDomain == "ChinaMobile":
return HETZNER_FSN_1GE
if info.IspDomain == "ChinaTelecom":
return CLOUDCONE_LAX_LB
if info.CountryCode == "CN":
return default_server
if ip == "0.11.45.14":
return {
default_server: 3,
CLOUDCONE_LAX1_1GE: 2,
CLOUDCONE_LAX2_1GE: 1,
}
return default_server
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