diff --git a/.gitignore b/.gitignore index d9addfc..937e8d8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .vscode/settings.json dist template.json -.idea \ No newline at end of file +.idea +test \ No newline at end of file diff --git a/common/convert.go b/common/convert.go index 432fee3..d243dfe 100644 --- a/common/convert.go +++ b/common/convert.go @@ -161,7 +161,11 @@ func AddCountryGroup(proxies []model.Outbound, groupType string, sortKey string, func MergeTemplate(outbounds []model.Outbound, template string) (string, error) { var config model.Config var err error - if strings.HasPrefix(template, "http") { + isNetworkFile, err := regexp.MatchString(`^https?://`, template) + if err != nil { + return "", err + } + if isNetworkFile { data, err := util.Fetch(template, 3) if err != nil { return "", err diff --git a/test/country_test.go b/test/country_test.go deleted file mode 100644 index a6a5fed..0000000 --- a/test/country_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package model - -import ( - "log" - "sub2sing-box/model" - "testing" -) - -func TestCountry(t *testing.T) { - log.Println(model.GetContryName("US 节点")) -}