navigator/mapping/map.go

40 lines
669 B
Go
Raw Normal View History

package mapping
import (
"flag"
"git.eve.moe/jackyyf/navigator/mapping/elf"
)
var (
defaultServer = flag.String("fallback-node",
"xe-mci1-us.edge.eve.network",
"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()
}
func Get(ip string) string {
ret := elf.GetMapping(ip)
if ret == "" {
return *defaultServer
}
return ret
}
func GetSuffix(ip string) string {
ret := elf.GetSuffix(ip)
if ret == "" {
return *defaultSuffix
}
return ret
}
func GetNodes() []string {
return elf.GetNodes()
}