From eeb40c9ce2df5390eef75c67cb08507dc1cdb1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E3=81=AE=E3=81=8B=E3=81=88=E3=81=A7?= Date: Thu, 8 Apr 2021 22:51:55 +0800 Subject: [PATCH] Refine tests --- common/matcher/geoip/geoip_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common/matcher/geoip/geoip_test.go b/common/matcher/geoip/geoip_test.go index b2bee0c4..48bc5286 100644 --- a/common/matcher/geoip/geoip_test.go +++ b/common/matcher/geoip/geoip_test.go @@ -5,12 +5,12 @@ import ( "path/filepath" "testing" - "github.com/golang/protobuf/proto" "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/matcher/geoip" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/platform" "github.com/xtls/xray-core/common/platform/filesystem" + "google.golang.org/protobuf/proto" ) func init() { @@ -20,16 +20,15 @@ func init() { if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && os.IsNotExist(err) { common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoip.dat"), filepath.Join(wd, "..", "..", "..", "resources", "geoip.dat"))) } + if _, err := os.Stat(platform.GetAssetLocation("geoiptestrouter.dat")); err != nil && os.IsNotExist(err) { + common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoiptestrouter.dat"), filepath.Join(wd, "..", "..", "..", "resources", "geoip.dat"))) + } if _, err := os.Stat(platform.GetAssetLocation("geosite.dat")); err != nil && os.IsNotExist(err) { common.Must(filesystem.CopyFile(platform.GetAssetLocation("geosite.dat"), filepath.Join(wd, "..", "..", "..", "resources", "geosite.dat"))) } } func TestParseIPList(t *testing.T) { - t.Log(os.Getenv("xray.location.asset")) - - common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoiptestrouter.dat"), platform.GetAssetLocation("geoip.dat"))) - ips := []string{ "geoip:us", "geoip:cn",