navigator/rules/map.starlark

44 lines
1.2 KiB
Plaintext

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_LAX3_1GE = "ge-lax3-us"
HOSTSOLUTIONS_OMR1_1GE = "ge-omr1-ro"
CLOUDCONE_LAX_LB = (CLOUDCONE_LAX1_1GE, CLOUDCONE_LAX2_1GE, CLOUDCONE_LAX3_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 [WHOLESALE_INTERNET_10GE, HETZNER_FSN_1GE, CLOUDCONE_LAX_LB, HOSTSOLUTIONS_OMR1_1GE]
def getSuffix(ip):
info = geoLookup(ip)
if not info:
return default_suffix
if info.CountryCode == "CN":
return CHINA_MAINLAND_SUFFIX
return GLOBAL_SUFFIX