Add command server
This commit is contained in:
16
custom/command_server.go
Normal file
16
custom/command_server.go
Normal file
@@ -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()
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
2
go.mod
2
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
|
||||
|
||||
Reference in New Issue
Block a user