From 0ed159e41d7d566b7fcd465be2161f49abc0c60e Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Wed, 12 Mar 2025 13:33:52 +0800 Subject: [PATCH] chore: code cleanup --- adapter/provider/provider.go | 7 ------- config/config.go | 12 ------------ go.mod | 16 ++++++++-------- go.sum | 8 ++++---- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/adapter/provider/provider.go b/adapter/provider/provider.go index 2abf9618..3dccefea 100644 --- a/adapter/provider/provider.go +++ b/adapter/provider/provider.go @@ -326,13 +326,6 @@ func (cp *CompatibleProvider) Close() error { return cp.compatibleProvider.Close() } -func proxiesOnUpdate(pd *proxySetProvider) func([]C.Proxy) { - return func(elm []C.Proxy) { - pd.setProxies(elm) - pd.version += 1 - } -} - func NewProxiesParser(filter string, excludeFilter string, excludeType string, dialerProxy string, override OverrideSchema) (resource.Parser[[]C.Proxy], error) { excludeFilterReg, err := regexp2.Compile(excludeFilter, regexp2.None) if err != nil { diff --git a/config/config.go b/config/config.go index ba6097bc..ce1e0fb7 100644 --- a/config/config.go +++ b/config/config.go @@ -428,12 +428,6 @@ type RawConfig struct { ClashForAndroid RawClashForAndroid `yaml:"clash-for-android" json:"clash-for-android"` } -var ( - GroupsList = list.New() - ProxiesList = list.New() - ParsingProxiesCallback func(groupsList *list.List, proxiesList *list.List) -) - // Parse config func Parse(buf []byte) (*Config, error) { rawCfg, err := UnmarshalRawConfig(buf) @@ -927,12 +921,6 @@ func parseProxies(cfg *RawConfig) (proxies map[string]C.Proxy, providersMap map[ ) proxies["GLOBAL"] = adapter.NewProxy(global) } - ProxiesList = proxiesList - GroupsList = groupsList - if ParsingProxiesCallback != nil { - // refresh tray menu - go ParsingProxiesCallback(GroupsList, ProxiesList) - } return proxies, providersMap, nil } diff --git a/go.mod b/go.mod index 5758ffd0..ffc2685d 100644 --- a/go.mod +++ b/go.mod @@ -7,14 +7,14 @@ require ( github.com/bahlo/generic-list-go v0.2.0 github.com/coreos/go-iptables v0.8.0 github.com/dlclark/regexp2 v1.11.5 - github.com/enfein/mieru/v3 v3.11.2 + github.com/enfein/mieru/v3 v3.12.0 github.com/go-chi/chi/v5 v5.2.1 github.com/go-chi/render v1.0.3 github.com/gobwas/ws v1.4.0 github.com/gofrs/uuid/v5 v5.3.1 github.com/insomniacslk/dhcp v0.0.0-20250109001534-8abf58130905 github.com/klauspost/compress v1.17.9 // lastest version compatible with golang1.20 - github.com/klauspost/cpuid/v2 v2.2.9 + github.com/klauspost/cpuid/v2 v2.2.9 // lastest version compatible with golang1.20 github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 github.com/mdlayher/netlink v1.7.2 github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab @@ -37,7 +37,7 @@ require ( github.com/mroth/weightedrand/v2 v2.1.0 github.com/openacid/low v0.1.21 github.com/oschwald/maxminddb-golang v1.12.0 // lastest version compatible with golang1.20 - github.com/puzpuzpuz/xsync/v3 v3.5.0 + github.com/puzpuzpuz/xsync/v3 v3.5.1 github.com/sagernet/cors v1.2.1 github.com/sagernet/fswatch v0.1.1 github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a @@ -46,7 +46,7 @@ require ( github.com/sagernet/sing-shadowtls v0.1.5 github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 github.com/samber/lo v1.49.1 - github.com/shirou/gopsutil/v4 v4.25.1 + github.com/shirou/gopsutil/v4 v4.25.1 // lastest version compatible with golang1.20 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 github.com/vmihailenco/msgpack/v5 v5.4.1 @@ -54,13 +54,13 @@ require ( gitlab.com/go-extension/aes-ccm v0.0.0-20230221065045-e58665ef23c7 go.uber.org/automaxprocs v1.6.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/crypto v0.33.0 + golang.org/x/crypto v0.33.0 // lastest version compatible with golang1.20 golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // lastest version compatible with golang1.20 - golang.org/x/net v0.35.0 - golang.org/x/sys v0.30.0 + golang.org/x/net v0.35.0 // lastest version compatible with golang1.20 + golang.org/x/sys v0.30.0 // lastest version compatible with golang1.20 google.golang.org/protobuf v1.34.2 // lastest version compatible with golang1.20 gopkg.in/yaml.v3 v3.0.1 - lukechampine.com/blake3 v1.3.0 + lukechampine.com/blake3 v1.3.0 // lastest version compatible with golang1.20 ) require ( diff --git a/go.sum b/go.sum index 44d174b7..feacad2d 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZ github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I= github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/enfein/mieru/v3 v3.11.2 h1:06KyGbXiiGz2nSHLJDOOkztAVY3cRr3wBMOpYxPotTo= -github.com/enfein/mieru/v3 v3.11.2/go.mod h1:XvVfNsM78lUMSlJJKXJZ0Hn3lAB2o/ETXTbb84x5egw= +github.com/enfein/mieru/v3 v3.12.0 h1:sV3moozWpRjjqwqFZJjGtMB0EacN8+D7BpjzsmacsXM= +github.com/enfein/mieru/v3 v3.12.0/go.mod h1:zJBUCsi5rxyvHM8fjFf+GLaEl4OEjjBXr1s5F6Qd3hM= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9 h1:/5RkVc9Rc81XmMyVqawCiDyrBHZbLAZgTTCqou4mwj8= github.com/ericlagergren/aegis v0.0.0-20230312195928-b4ce538b56f9/go.mod h1:hkIFzoiIPZYxdFOOLyDho59b7SrDfo+w3h+yWdlg45I= github.com/ericlagergren/polyval v0.0.0-20220411101811-e25bc10ba391 h1:8j2RH289RJplhA6WfdaPqzg1MjH2K8wX5e0uhAxrw2g= @@ -156,8 +156,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= -github.com/puzpuzpuz/xsync/v3 v3.5.0 h1:i+cMcpEDY1BkNm7lPDkCtE4oElsYLn+EKF8kAu2vXT4= -github.com/puzpuzpuz/xsync/v3 v3.5.0/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= +github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++5Fg= +github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.4.1 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs=