mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-25 06:46:09 +03:00
chore: clean code
This commit is contained in:
parent
e06c901bf5
commit
05e4237e71
@ -1,5 +1,3 @@
|
||||
//go:build !premium
|
||||
|
||||
package config
|
||||
|
||||
import (
|
@ -1,36 +0,0 @@
|
||||
//go:build premium
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/Dreamacro/clash/config"
|
||||
)
|
||||
|
||||
func forEachProviders(rawCfg *config.RawConfig, fun func(index int, total int, key string, provider map[string]any)) {
|
||||
total := len(rawCfg.ProxyProvider) + len(rawCfg.RuleProvider)
|
||||
index := 0
|
||||
|
||||
for k, v := range rawCfg.ProxyProvider {
|
||||
fun(index, total, k, v)
|
||||
|
||||
index++
|
||||
}
|
||||
|
||||
for k, v := range rawCfg.RuleProvider {
|
||||
fun(index, total, k, v)
|
||||
|
||||
index++
|
||||
}
|
||||
}
|
||||
|
||||
func destroyProviders(cfg *config.Config) {
|
||||
for _, p := range cfg.ProxyProviders {
|
||||
_ = p.(io.Closer).Close()
|
||||
}
|
||||
|
||||
for _, p := range cfg.RuleProviders {
|
||||
_ = p.(io.Closer).Close()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user