Files
umbrix-libcore/custom/command_server.go

34 lines
775 B
Go
Raw Normal View History

2023-08-28 13:07:21 +03:30
package main
import "github.com/sagernet/sing-box/experimental/libbox"
var commandServer *libbox.CommandServer
type CommandServerHandler struct{}
func (csh *CommandServerHandler) ServiceReload() error {
2023-09-10 20:18:33 +03:30
propagateStatus(Starting)
if commandServer != nil {
commandServer.SetService(nil)
commandServer = nil
}
if box != nil {
box.Close()
box = nil
}
return startService()
2023-08-28 13:07:21 +03:30
}
2023-09-05 19:00:24 +03:30
func (csh *CommandServerHandler) GetSystemProxyStatus() *libbox.SystemProxyStatus {
return &libbox.SystemProxyStatus{Available: true, Enabled: false}
}
func (csh *CommandServerHandler) SetSystemProxyEnabled(isEnabled bool) error {
return nil
}
2023-08-28 13:07:21 +03:30
func startCommandServer() error {
commandServer = libbox.NewCommandServer(&CommandServerHandler{}, 300)
return commandServer.Start()
}