diff --git a/mapping/map.go b/mapping/map.go index 6ae9f4e..9d1ed7d 100644 --- a/mapping/map.go +++ b/mapping/map.go @@ -1,6 +1,7 @@ package mapping import ( + "flag" "git.eve.moe/jackyyf/navigator/ipgeo" ) @@ -17,6 +18,10 @@ const ( 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. func Get(ip string) string { db := ipgeo.Get() @@ -24,7 +29,7 @@ func Get(ip string) string { if err != nil { 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 + GLOBAL_SUFFIX