mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2025-02-22 01:33:16 +03:00
using hub.ApplyConfig to start the external controller
This commit is contained in:
parent
90f3a09805
commit
e548b933e2
@ -9,11 +9,10 @@ import (
|
|||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
"cfa/native/app"
|
"cfa/native/app"
|
||||||
"github.com/metacubex/mihomo/log"
|
|
||||||
|
|
||||||
"github.com/metacubex/mihomo/config"
|
"github.com/metacubex/mihomo/config"
|
||||||
"github.com/metacubex/mihomo/hub/executor"
|
"github.com/metacubex/mihomo/hub"
|
||||||
"github.com/metacubex/mihomo/hub/route"
|
"github.com/metacubex/mihomo/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func logDns(cfg *config.RawConfig) {
|
func logDns(cfg *config.RawConfig) {
|
||||||
@ -79,16 +78,7 @@ func Load(path string) error {
|
|||||||
|
|
||||||
// Start the external controller like in hub.Parse(), but we have set its
|
// Start the external controller like in hub.Parse(), but we have set its
|
||||||
// default override value to end with ":0" for security.
|
// default override value to end with ":0" for security.
|
||||||
//
|
hub.ApplyConfig(cfg)
|
||||||
// It would be difficult to update configurations for external controller
|
|
||||||
// inbound, so changes will require a restart after a profile is loaded.
|
|
||||||
if cfg.Controller.ExternalController != "" && !strings.HasSuffix(cfg.Controller.ExternalController, ":0") {
|
|
||||||
go route.Start(cfg.Controller.ExternalController, cfg.Controller.ExternalControllerTLS,
|
|
||||||
cfg.Controller.Secret, cfg.TLS.Certificate, cfg.TLS.PrivateKey, cfg.Controller.ExternalDohServer,
|
|
||||||
cfg.General.LogLevel == log.DEBUG)
|
|
||||||
}
|
|
||||||
|
|
||||||
executor.ApplyConfig(cfg, true)
|
|
||||||
|
|
||||||
app.ApplySubtitlePattern(rawCfg.ClashForAndroid.UiSubtitlePattern)
|
app.ApplySubtitlePattern(rawCfg.ClashForAndroid.UiSubtitlePattern)
|
||||||
|
|
||||||
@ -103,5 +93,5 @@ func LoadDefault() {
|
|||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
executor.ApplyConfig(cfg, true)
|
hub.ApplyConfig(cfg)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user