From a3bf6f3d76b99150405d3f0c624ca126d8cff0c6 Mon Sep 17 00:00:00 2001 From: Yifu Yu Date: Thu, 7 Nov 2019 15:18:44 +0800 Subject: [PATCH] Add a switch to enable china domain before various issues are resolved. --- mapping/map.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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