mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-17 12:43:18 +08:00
⚡️ Improve
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func GetContryName(countryKey string) string {
|
||||
// 创建一个切片包含所有的国家映射
|
||||
|
||||
countryMaps := []map[string]string{
|
||||
model.CountryFlag,
|
||||
model.CountryChineseName,
|
||||
@ -19,11 +19,9 @@ func GetContryName(countryKey string) string {
|
||||
model.CountryEnglishName,
|
||||
}
|
||||
|
||||
// 对每一个映射进行检查
|
||||
for i, countryMap := range countryMaps {
|
||||
if i == 2 {
|
||||
// 对ISO匹配做特殊处理
|
||||
// 根据常用分割字符分割字符串
|
||||
|
||||
splitChars := []string{"-", "_", " "}
|
||||
key := make([]string, 0)
|
||||
for _, splitChar := range splitChars {
|
||||
@ -34,9 +32,9 @@ func GetContryName(countryKey string) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 对每一个分割后的字符串进行检查
|
||||
|
||||
for _, v := range key {
|
||||
// 如果匹配到了国家
|
||||
|
||||
if country, ok := countryMap[strings.ToUpper(v)]; ok {
|
||||
return country
|
||||
}
|
||||
@ -56,7 +54,7 @@ func AddProxy(
|
||||
lazy bool, clashType model.ClashType, proxies ...model.Proxy,
|
||||
) {
|
||||
proxyTypes := model.GetSupportProxyTypes(clashType)
|
||||
// 添加节点
|
||||
|
||||
for _, proxy := range proxies {
|
||||
if !proxyTypes[proxy.Type] {
|
||||
continue
|
||||
@ -106,7 +104,7 @@ func ParseProxy(proxies ...string) []model.Proxy {
|
||||
if proxy != "" {
|
||||
var proxyItem model.Proxy
|
||||
var err error
|
||||
// 解析节点
|
||||
|
||||
if strings.HasPrefix(proxy, constant.ShadowsocksPrefix) {
|
||||
proxyItem, err = parser.ParseShadowsocks(proxy)
|
||||
}
|
||||
|
Reference in New Issue
Block a user