package mapping import ( "flag" "git.eve.moe/jackyyf/navigator/mapping/elf" "git.eve.moe/jackyyf/navigator/mapping/firefly" ) var ( defaultServer = flag.String("fallback-node", "xe-mci1-us", "Default CDN node in case of any script error") defaultSuffix = flag.String("fallback-suffix", ".edge.eve.network", "Default CDN suffix in case of any script error") ) func Initialize() { elf.Initialize() firefly.Initialize() } func Get(ip string) string { node := elf.GetMapping(ip) if node == "" { node = *defaultServer } suffix := elf.GetSuffix(ip) if suffix == "" { suffix = *defaultSuffix } return node + suffix } func GetSuffix(ip string) string { ret := elf.GetSuffix(ip) if ret == "" { return *defaultSuffix } return ret } func GetNodes() []string { return elf.GetNodes() }