Add: external controller

This commit is contained in:
Dreamacro
2018-06-18 11:31:49 +08:00
parent bc4ca2818b
commit 79e5338113
5 changed files with 120 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"syscall"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/hub"
"github.com/Dreamacro/clash/proxy/http"
"github.com/Dreamacro/clash/proxy/socks"
"github.com/Dreamacro/clash/tunnel"
@ -37,6 +38,11 @@ func main() {
go http.NewHttpProxy(port)
go socks.NewSocksProxy(socksPort)
// Hub
if key, err := section.GetKey("external-controller"); err == nil {
go hub.NewHub(key.Value())
}
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
<-sigCh