Auto detect if need country group

This commit is contained in:
2024-10-01 12:45:55 +08:00
parent 59a258f4ef
commit 5fea337b6c
3 changed files with 10 additions and 4 deletions

View File

@ -90,7 +90,13 @@ func Convert(
return "", err
}
reg := regexp.MustCompile("\"<[A-Za-z]{2}>\"")
if reg.MatchString(templateDate) || strings.Contains(templateDate, constant.AllCountryTags) {
group := false
for _, v := range model.CountryEnglishName {
if strings.Contains(templateDate, v) {
group = true
}
}
if reg.MatchString(templateDate) || strings.Contains(templateDate, constant.AllCountryTags) || group {
outbounds = AddCountryGroup(outbounds, groupType, sortKey, sortType)
}
var template model.Config