mirror of
https://github.com/bestnite/sub2sing-box.git
synced 2025-10-28 09:33:57 +00:00
重构部分代码
fix: vless ws 配置缺少 path 字段
This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
C "sub2sing-box/constant"
|
||||
|
||||
"golang.org/x/text/collate"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
type SortByNumber []Outbound
|
||||
|
||||
func (a SortByNumber) Len() int { return len(a) }
|
||||
func (a SortByNumber) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a SortByNumber) Less(i, j int) bool { return len(a[i].Outbounds) < len(a[j].Outbounds) }
|
||||
func (a SortByNumber) Len() int { return len(a) }
|
||||
func (a SortByNumber) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a SortByNumber) Less(i, j int) bool {
|
||||
var size1, size2 int
|
||||
if a[i].Type == C.TypeSelector {
|
||||
size1 = len(a[i].SelectorOptions.Outbounds)
|
||||
}
|
||||
if a[i].Type == C.TypeURLTest {
|
||||
size1 = len(a[j].URLTestOptions.Outbounds)
|
||||
}
|
||||
if a[j].Type == C.TypeSelector {
|
||||
size2 = len(a[j].SelectorOptions.Outbounds)
|
||||
}
|
||||
if a[j].Type == C.TypeURLTest {
|
||||
size2 = len(a[j].URLTestOptions.Outbounds)
|
||||
}
|
||||
return size1 < size2
|
||||
}
|
||||
|
||||
type SortByTag []Outbound
|
||||
|
||||
|
||||
Reference in New Issue
Block a user