From 03cf8c6c22e6ab44300e3673702b37c6dd66f0a0 Mon Sep 17 00:00:00 2001 From: zu1k Date: Wed, 26 Aug 2020 13:41:12 +0800 Subject: [PATCH] fix name reindex --- pkg/proxy/proxies.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/proxy/proxies.go b/pkg/proxy/proxies.go index 9a018a2..9550fbe 100644 --- a/pkg/proxy/proxies.go +++ b/pkg/proxy/proxies.go @@ -3,6 +3,7 @@ package proxy import ( "fmt" "sort" + "strings" "sync" ) @@ -94,8 +95,7 @@ func (ps ProxyList) NameReIndex() ProxyList { num := len(ps) for i := 0; i < num; i++ { originName := ps[i].BaseInfo().Name - // country := string([]rune(originName)[:2]) - country := string([]rune(originName)[:5]) + country := strings.SplitN(originName, "_", 2)[0] ps[i].SetName(fmt.Sprintf("%s_%+02v", country, i+1)) } return ps