2018-11-21 13:47:46 +08:00
|
|
|
package hub
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/Dreamacro/clash/hub/executor"
|
|
|
|
"github.com/Dreamacro/clash/hub/route"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Parse call at the beginning of clash
|
|
|
|
func Parse() error {
|
|
|
|
cfg, err := executor.Parse()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-12-20 01:29:13 +08:00
|
|
|
if cfg.General.ExternalUI != "" {
|
|
|
|
route.SetUIPath(cfg.General.ExternalUI)
|
|
|
|
}
|
|
|
|
|
2018-11-21 13:47:46 +08:00
|
|
|
if cfg.General.ExternalController != "" {
|
|
|
|
go route.Start(cfg.General.ExternalController, cfg.General.Secret)
|
|
|
|
}
|
|
|
|
|
2018-11-30 17:42:40 +08:00
|
|
|
executor.ApplyConfig(cfg, true)
|
2018-11-21 13:47:46 +08:00
|
|
|
return nil
|
|
|
|
}
|