diff --git a/custom/command_server.go b/custom/command_server.go new file mode 100644 index 0000000..20f0093 --- /dev/null +++ b/custom/command_server.go @@ -0,0 +1,16 @@ +package main + +import "github.com/sagernet/sing-box/experimental/libbox" + +var commandServer *libbox.CommandServer + +type CommandServerHandler struct{} + +func (csh *CommandServerHandler) ServiceReload() error { + return nil +} + +func startCommandServer() error { + commandServer = libbox.NewCommandServer(&CommandServerHandler{}, 300) + return commandServer.Start() +} diff --git a/custom/service.go b/custom/service.go index be57350..b1e05bd 100644 --- a/custom/service.go +++ b/custom/service.go @@ -15,7 +15,6 @@ import ( ) var ( - sBasePath string sWorkingPath string sTempPath string sUserID int @@ -23,7 +22,7 @@ var ( ) func Setup(basePath string, workingPath string, tempPath string) { - sBasePath = basePath + libbox.Setup(basePath, workingPath, tempPath, false) sWorkingPath = workingPath sTempPath = tempPath sUserID = os.Getuid() diff --git a/go.mod b/go.mod index bd386d0..b606f5d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/sagernet/gomobile v0.0.0-20230728014906-3de089147f59 github.com/sagernet/sing v0.2.10-0.20230824115837-8d731e68853a - github.com/sagernet/sing-box v1.3.6 + github.com/sagernet/sing-box v1.4.0-rc.1.0.20230824140328-442370093191 github.com/sagernet/sing-dns v0.1.9-0.20230824120133-4d5cbceb40c1 github.com/xmdhs/clash2singbox v0.0.0-20230827075945-bb6d561314bb gopkg.in/yaml.v3 v3.0.1