mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-16 02:22:17 +08: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"
|
||||
|
||||
"cfa/native/app"
|
||||
"github.com/metacubex/mihomo/log"
|
||||
|
||||
"github.com/metacubex/mihomo/config"
|
||||
"github.com/metacubex/mihomo/hub/executor"
|
||||
"github.com/metacubex/mihomo/hub/route"
|
||||
"github.com/metacubex/mihomo/hub"
|
||||
"github.com/metacubex/mihomo/log"
|
||||
)
|
||||
|
||||
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
|
||||
// default override value to end with ":0" for security.
|
||||
//
|
||||
// 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)
|
||||
hub.ApplyConfig(cfg)
|
||||
|
||||
app.ApplySubtitlePattern(rawCfg.ClashForAndroid.UiSubtitlePattern)
|
||||
|
||||
|
@ -103,5 +93,5 @@ func LoadDefault() {
|
|||
panic(err.Error())
|
||||
}
|
||||
|
||||
executor.ApplyConfig(cfg, true)
|
||||
hub.ApplyConfig(cfg)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user