Add a switch to enable china domain before various issues are resolved.
This commit is contained in:
parent
f3f2898e26
commit
a3bf6f3d76
|
@ -1,6 +1,7 @@
|
||||||
package mapping
|
package mapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"git.eve.moe/jackyyf/navigator/ipgeo"
|
"git.eve.moe/jackyyf/navigator/ipgeo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +18,10 @@ const (
|
||||||
default_suffix = GLOBAL_SUFFIX
|
default_suffix = GLOBAL_SUFFIX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
enableCNDomain = flag.Bool("enable-cn-domain", false, "Enable china mainland specific domain")
|
||||||
|
)
|
||||||
|
|
||||||
// Get returns the edge node that should be used for client.
|
// Get returns the edge node that should be used for client.
|
||||||
func Get(ip string) string {
|
func Get(ip string) string {
|
||||||
db := ipgeo.Get()
|
db := ipgeo.Get()
|
||||||
|
@ -24,7 +29,7 @@ func Get(ip string) string {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return default_server + default_suffix
|
return default_server + default_suffix
|
||||||
}
|
}
|
||||||
if info_en.CountryCode == "CN" {
|
if *enableCNDomain && info_en.CountryCode == "CN" {
|
||||||
return default_server + CHINA_MAINLAND_SUFFIX
|
return default_server + CHINA_MAINLAND_SUFFIX
|
||||||
}
|
}
|
||||||
return default_server + GLOBAL_SUFFIX
|
return default_server + GLOBAL_SUFFIX
|
||||||
|
|
Loading…
Reference in New Issue