Skip to content

Commit

Permalink
保持原有的节点顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
xmdhs committed Feb 15, 2024
1 parent 48358a3 commit 395ce97
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"strconv"

"github.com/samber/lo"
"github.com/xmdhs/clash2singbox/model/clash"
"github.com/xmdhs/clash2singbox/model/singbox"
)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 395ce97

Please sign in to comment.