From 395ce9757141bcd46dbd17914ee8dbd2ab30366c Mon Sep 17 00:00:00 2001 From: xmdhs Date: Thu, 15 Feb 2024 10:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E6=8C=81=E5=8E=9F=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/xmdhs/clash2sfa/issues/30 --- convert/convert.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/convert/convert.go b/convert/convert.go index 3c3791c..8202684 100644 --- a/convert/convert.go +++ b/convert/convert.go @@ -5,7 +5,6 @@ import ( "fmt" "strconv" - "github.com/samber/lo" "github.com/xmdhs/clash2singbox/model/clash" "github.com/xmdhs/clash2singbox/model/singbox" ) @@ -32,7 +31,7 @@ func oldConver(f func(*clash.Proxies, *singbox.SingBoxOut) error) func(*clash.Pr } func Clash2sing(c clash.Clash) ([]singbox.SingBoxOut, error) { - slm := make(map[string]singbox.SingBoxOut, len(c.Proxies)+1) + sl := make([]singbox.SingBoxOut, 0, len(c.Proxies)+1) var jerr error for _, v := range c.Proxies { v := v @@ -46,11 +45,12 @@ func Clash2sing(c clash.Clash) ([]singbox.SingBoxOut, error) { jerr = errors.Join(jerr, err) continue } - for _, v := range nsl { - slm[v.Tag] = v - } + sl = append(sl, nsl...) + } + slm := make(map[string]singbox.SingBoxOut, len(c.Proxies)+1) + for _, v := range sl { + slm[v.Tag] = v } - sl := lo.Values(slm) for _, v := range c.ProxyGroup { if v.Type != "relay" { continue