2019-10-27 16:54:23 +08:00
|
|
|
package mapping
|
|
|
|
|
|
|
|
import (
|
2019-11-07 15:18:44 +08:00
|
|
|
"flag"
|
2019-11-17 03:51:15 +08:00
|
|
|
"git.eve.moe/jackyyf/navigator/mapping/elf"
|
2019-10-27 16:54:23 +08:00
|
|
|
)
|
|
|
|
|
2019-11-07 15:18:44 +08:00
|
|
|
var (
|
2019-11-17 03:51:15 +08:00
|
|
|
defaultServer = flag.String("fallback-node",
|
|
|
|
"xe-mci1-us.edge.eve.network",
|
|
|
|
"Default CDN node in case of any error when executing script")
|
2019-11-07 15:18:44 +08:00
|
|
|
)
|
|
|
|
|
2019-11-17 03:51:15 +08:00
|
|
|
func Initialize() {
|
|
|
|
elf.Initialize()
|
|
|
|
}
|
|
|
|
|
2019-10-27 16:54:23 +08:00
|
|
|
func Get(ip string) string {
|
2019-11-17 03:51:15 +08:00
|
|
|
ret := elf.GetMapping(ip)
|
|
|
|
if ret == "" {
|
|
|
|
return *defaultServer
|
2019-10-27 16:54:23 +08:00
|
|
|
}
|
2019-11-17 03:51:15 +08:00
|
|
|
return ret
|
2019-10-27 16:54:23 +08:00
|
|
|
}
|