feat: add tls port for RESTful api and external controller
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package hub
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/Dreamacro/clash/config"
|
||||
"github.com/Dreamacro/clash/hub/executor"
|
||||
"github.com/Dreamacro/clash/hub/route"
|
||||
@ -42,7 +44,12 @@ func Parse(options ...Option) error {
|
||||
}
|
||||
|
||||
if cfg.General.ExternalController != "" {
|
||||
go route.Start(cfg.General.ExternalController, cfg.General.Secret)
|
||||
if cfg.General.TLSPort != 0 && (len(cfg.General.PrivateKey) == 0 || len(cfg.General.Cert) == 0) {
|
||||
return errors.New("Must be provided certificates and keys, for tls controller")
|
||||
}
|
||||
|
||||
go route.Start(cfg.General.ExternalController, cfg.General.Secret, cfg.General.TLSPort,
|
||||
cfg.General.Cert, cfg.General.PrivateKey)
|
||||
}
|
||||
|
||||
executor.ApplyConfig(cfg, true)
|
||||
|
Reference in New Issue
Block a user