mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2026-05-09 18:11:26 +08:00
using hub.ApplyConfig to start the external controller
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user