2019-11-17 03:51:15 +08:00
|
|
|
WHOLESALE_INTERNET_10GE = "xe-mci1-us"
|
|
|
|
HETZNER_FSN_1GE = "ge-fsn1-de"
|
|
|
|
HETZNER_HEL_1GE = "ge-hel1-fi"
|
2019-12-26 01:10:26 +08:00
|
|
|
CLOUDCONE_LAX1_1GE = "ge-lax1-us"
|
|
|
|
CLOUDCONE_LAX2_1GE = "ge-lax2-us"
|
2020-01-12 22:09:30 +08:00
|
|
|
CLOUDCONE_LAX3_1GE = "ge-lax3-us"
|
|
|
|
HOSTSOLUTIONS_OMR1_1GE = "ge-omr1-ro"
|
|
|
|
CLOUDCONE_LAX_LB = (CLOUDCONE_LAX1_1GE, CLOUDCONE_LAX2_1GE, CLOUDCONE_LAX3_1GE)
|
2019-11-17 03:51:15 +08:00
|
|
|
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:
|
2019-12-26 01:10:26 +08:00
|
|
|
return default_server
|
2019-11-17 03:51:15 +08:00
|
|
|
if info.IspDomain == "ChinaMobile":
|
2019-12-26 01:10:26 +08:00
|
|
|
return HETZNER_FSN_1GE
|
|
|
|
if info.IspDomain == "ChinaTelecom":
|
|
|
|
return CLOUDCONE_LAX_LB
|
2019-11-17 03:51:15 +08:00
|
|
|
if info.CountryCode == "CN":
|
2019-12-26 01:10:26 +08:00
|
|
|
return default_server
|
|
|
|
if ip == "0.11.45.14":
|
|
|
|
return {
|
|
|
|
default_server: 3,
|
|
|
|
CLOUDCONE_LAX1_1GE: 2,
|
|
|
|
CLOUDCONE_LAX2_1GE: 1,
|
|
|
|
}
|
|
|
|
return default_server
|
2019-11-17 03:51:15 +08:00
|
|
|
|
|
|
|
def getNodes():
|
2020-01-12 22:09:30 +08:00
|
|
|
return [WHOLESALE_INTERNET_10GE, HETZNER_FSN_1GE, CLOUDCONE_LAX_LB, HOSTSOLUTIONS_OMR1_1GE]
|
2019-11-29 16:16:18 +08:00
|
|
|
|
|
|
|
def getSuffix(ip):
|
|
|
|
info = geoLookup(ip)
|
|
|
|
if not info:
|
|
|
|
return default_suffix
|
|
|
|
if info.CountryCode == "CN":
|
|
|
|
return CHINA_MAINLAND_SUFFIX
|
|
|
|
return GLOBAL_SUFFIX
|