diff --git a/Makefile b/Makefile
index 1bc8fee..b467408 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@ release: # Create a new tag for release.
sed -i -e "s|CFBundleVersion\s*[^<]*|CFBundleVersion$${VERSION_STR}|" Info.plist &&\
sed -i -e "s|CFBundleShortVersionString\s*[^<]*|CFBundleShortVersionString$${VERSION_STR}|" Info.plist &&\
sed -i "s|ENV VERSION=.*|ENV VERSION=v$${TAG}|g" docker/Dockerfile && \
- git add Info.plist && \
+ git add Info.plist docker/Dockerfile && \
git commit -m "release: version $${TAG}" && \
echo "creating git tag : v$${TAG}" && \
git push && \
diff --git a/custom/command_admin_service.go b/custom/command_admin_service.go
deleted file mode 100644
index 982978b..0000000
--- a/custom/command_admin_service.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2015 Daniel Theophanes.
-// Use of this source code is governed by a zlib-style
-// license that can be found in the LICENSE file.
-
-// simple does nothing except block while running the service.
-package main
-
-import "C"
-import (
- "fmt"
-
- "github.com/hiddify/libcore/admin_service"
-)
-
-//export AdminServiceStart
-func AdminServiceStart(arg *C.char) *C.char {
- goArg := C.GoString(arg)
- exitCode, outMessage := admin_service.StartService(goArg)
- return C.CString(fmt.Sprintf("%d %s", exitCode, outMessage))
-
-}
diff --git a/custom/commands.go b/custom/commands.go
deleted file mode 100644
index 3771368..0000000
--- a/custom/commands.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package main
-
-import (
- "github.com/sagernet/sing-box/experimental/libbox"
- "github.com/sagernet/sing-box/log"
-)
-
-var (
- statusClient *libbox.CommandClient
- groupClient *libbox.CommandClient
- groupInfoOnlyClient *libbox.CommandClient
-)
-
-func StartCommand(command int32, port int64, logFactory log.Factory) error {
- switch command {
- case libbox.CommandStatus:
- statusClient = libbox.NewCommandClient(
- &CommandClientHandler{
- port: port,
- logger: logFactory.NewLogger("[Status Command Client]"),
- },
- &libbox.CommandClientOptions{
- Command: libbox.CommandStatus,
- StatusInterval: 1000000000, //1000ms debounce
- },
- )
- return statusClient.Connect()
- case libbox.CommandGroup:
- groupClient = libbox.NewCommandClient(
- &CommandClientHandler{
- port: port,
- logger: logFactory.NewLogger("[Group Command Client]"),
- },
- &libbox.CommandClientOptions{
- Command: libbox.CommandGroup,
- StatusInterval: 300000000, //300ms debounce
- },
- )
- return groupClient.Connect()
- case libbox.CommandGroupInfoOnly:
- groupInfoOnlyClient = libbox.NewCommandClient(
- &CommandClientHandler{
- port: port,
- logger: logFactory.NewLogger("[GroupInfoOnly Command Client]"),
- },
- &libbox.CommandClientOptions{
- Command: libbox.CommandGroupInfoOnly,
- StatusInterval: 300000000, //300ms debounce
- },
- )
- return groupInfoOnlyClient.Connect()
- }
- return nil
-}
-
-func StopCommand(command int32) error {
- switch command {
- case libbox.CommandStatus:
- err := statusClient.Disconnect()
- statusClient = nil
- return err
- case libbox.CommandGroup:
- err := groupClient.Disconnect()
- groupClient = nil
- return err
- case libbox.CommandGroupInfoOnly:
- err := groupInfoOnlyClient.Disconnect()
- groupInfoOnlyClient = nil
- return err
- }
- return nil
-}
diff --git a/custom/constant.go b/custom/constant.go
deleted file mode 100644
index a0a65a2..0000000
--- a/custom/constant.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package main
-
-const (
- Stopped = "Stopped"
- Starting = "Starting"
- Started = "Started"
- Stopping = "Stopping"
-)
-
-const (
- EmptyConfiguration = "EmptyConfiguration"
- StartCommandServer = "StartCommandServer"
- CreateService = "CreateService"
- StartService = "StartService"
-)
diff --git a/custom/custom.go b/custom/custom.go
index 89c7a92..9aa4174 100644
--- a/custom/custom.go
+++ b/custom/custom.go
@@ -7,10 +7,7 @@ import "C"
import (
"encoding/json"
"fmt"
- "io"
"os"
- "path/filepath"
- "time"
"unsafe"
"github.com/hiddify/libcore/bridge"
@@ -18,16 +15,9 @@ import (
pb "github.com/hiddify/libcore/hiddifyrpc"
v2 "github.com/hiddify/libcore/v2"
- "github.com/sagernet/sing-box/experimental/libbox"
"github.com/sagernet/sing-box/log"
- "github.com/sagernet/sing-box/option"
)
-// var v2.Box *libbox.BoxService
-var configOptions *config.ConfigOptions
-var activeConfigPath *string
-var logFactory *log.Factory
-
//export setupOnce
func setupOnce(api unsafe.Pointer) {
bridge.InitializeDartApi(api)
@@ -35,287 +25,146 @@ func setupOnce(api unsafe.Pointer) {
//export setup
func setup(baseDir *C.char, workingDir *C.char, tempDir *C.char, statusPort C.longlong, debug bool) (CErr *C.char) {
- defer config.DeferPanicToError("setup", func(err error) {
- CErr = C.CString(err.Error())
- fmt.Printf("Error: %+v\n", err)
- })
+ err := v2.Setup(C.GoString(baseDir), C.GoString(workingDir), C.GoString(tempDir), int64(statusPort), debug)
- Setup(C.GoString(baseDir), C.GoString(workingDir), C.GoString(tempDir))
- statusPropagationPort = int64(statusPort)
-
- var defaultWriter io.Writer
- if !debug {
- defaultWriter = io.Discard
- }
- factory, err := log.New(
- log.Options{
- DefaultWriter: defaultWriter,
- BaseTime: time.Now(),
- Observable: false,
- })
- if err != nil {
- return C.CString(err.Error())
- }
- logFactory = &factory
- return C.CString("")
+ return emptyOrErrorC(err)
}
//export parse
func parse(path *C.char, tempPath *C.char, debug bool) (CErr *C.char) {
- defer config.DeferPanicToError("parse", func(err error) {
- CErr = C.CString(err.Error())
+ res, err := v2.Parse(&pb.ParseRequest{
+ ConfigPath: C.GoString(path),
+ TempPath: C.GoString(tempPath),
})
+ if err != nil {
+ log.Error(err.Error())
+ return C.CString(err.Error())
+ }
- config, err := config.ParseConfig(C.GoString(tempPath), debug)
- if err != nil {
- return C.CString(err.Error())
- }
- err = os.WriteFile(C.GoString(path), config, 0644)
- if err != nil {
- return C.CString(err.Error())
- }
- return C.CString("")
+ err = os.WriteFile(C.GoString(path), []byte(res.Content), 0644)
+ return emptyOrErrorC(err)
}
//export changeConfigOptions
func changeConfigOptions(configOptionsJson *C.char) (CErr *C.char) {
- defer config.DeferPanicToError("changeConfigOptions", func(err error) {
- CErr = C.CString(err.Error())
+
+ _, err := v2.ChangeConfigOptions(&pb.ChangeConfigOptionsRequest{
+ ConfigOptionsJson: C.GoString(configOptionsJson),
})
-
- configOptions = &config.ConfigOptions{}
- err := json.Unmarshal([]byte(C.GoString(configOptionsJson)), configOptions)
- if err != nil {
- return C.CString(err.Error())
- }
- if configOptions.Warp.WireguardConfigStr != "" {
- err := json.Unmarshal([]byte(configOptions.Warp.WireguardConfigStr), &configOptions.Warp.WireguardConfig)
- if err != nil {
- return C.CString(err.Error())
- }
- }
-
- return C.CString("")
+ return emptyOrErrorC(err)
}
//export generateConfig
func generateConfig(path *C.char) (res *C.char) {
- defer config.DeferPanicToError("generateConfig", func(err error) {
- res = C.CString("error" + err.Error())
+ _, err := v2.GenerateConfig(&pb.GenerateConfigRequest{
+ Path: C.GoString(path),
})
-
- config, err := generateConfigFromFile(C.GoString(path), *configOptions)
- if err != nil {
- return C.CString("error" + err.Error())
- }
- return C.CString(config)
-}
-
-func generateConfigFromFile(path string, configOpt config.ConfigOptions) (string, error) {
- os.Chdir(filepath.Dir(path))
- content, err := os.ReadFile(path)
- if err != nil {
- return "", err
- }
- options, err := parseConfig(string(content))
- if err != nil {
- return "", err
- }
- config, err := config.BuildConfigJson(configOpt, options)
- if err != nil {
- return "", err
- }
- return config, nil
+ return emptyOrErrorC(err)
}
//export start
func start(configPath *C.char, disableMemoryLimit bool) (CErr *C.char) {
- defer config.DeferPanicToError("start", func(err error) {
- stopAndAlert("Unexpected Error!", err)
- CErr = C.CString(err.Error())
+
+ _, err := v2.Start(&pb.StartRequest{
+ ConfigPath: C.GoString(configPath),
+ EnableOldCommandServer: true,
+ DisableMemoryLimit: disableMemoryLimit,
})
-
- if v2.CoreState != pb.CoreState_STOPPED {
- return C.CString("")
- }
- propagateStatus(pb.CoreState_STARTING)
-
- path := C.GoString(configPath)
- activeConfigPath = &path
-
- libbox.SetMemoryLimit(!disableMemoryLimit)
- err := startService(false)
- if err != nil {
- return C.CString(err.Error())
- }
- return C.CString("")
-}
-
-func startService(delayStart bool) error {
- content, err := os.ReadFile(*activeConfigPath)
- if err != nil {
- return stopAndAlert(EmptyConfiguration, err)
- }
- options, err := parseConfig(string(content))
- if err != nil {
- return stopAndAlert(EmptyConfiguration, err)
- }
- os.Chdir(filepath.Dir(*activeConfigPath))
- var patchedOptions *option.Options
- patchedOptions, err = config.BuildConfig(*configOptions, options)
- if err != nil {
- return stopAndAlert("Error Building Config", err)
- }
-
- config.SaveCurrentConfig(filepath.Join(sWorkingPath, "current-config.json"), *patchedOptions)
-
- err = startCommandServer(*logFactory)
- if err != nil {
- return stopAndAlert(StartCommandServer, err)
- }
-
- instance, err := NewService(*patchedOptions)
- if err != nil {
- return stopAndAlert(CreateService, err)
- }
-
- if delayStart {
- time.Sleep(250 * time.Millisecond)
- }
-
- err = instance.Start()
- if err != nil {
- return stopAndAlert(StartService, err)
- }
- v2.Box = instance
- commandServer.SetService(v2.Box)
-
- propagateStatus(pb.CoreState_STARTED)
- return nil
+ return emptyOrErrorC(err)
}
//export stop
func stop() (CErr *C.char) {
- defer config.DeferPanicToError("stop", func(err error) {
- stopAndAlert("Unexpected Error in Stop!", err)
- CErr = C.CString(err.Error())
- })
- if v2.CoreState != pb.CoreState_STARTED {
- stopAndAlert("Already Stopped", nil)
- return C.CString("")
- }
- if v2.Box == nil {
- return C.CString("instance not found")
- }
- propagateStatus(pb.CoreState_STOPPING)
- config.DeactivateTunnelService()
- commandServer.SetService(nil)
-
- err := v2.Box.Close()
- if err != nil {
- stopAndAlert("Unexpected Error in Close!", err)
- return C.CString(err.Error())
- }
- v2.Box = nil
- err = commandServer.Close()
- if err != nil {
- stopAndAlert("Unexpected Error in Stop CommandServer/!", err)
- return C.CString(err.Error())
- }
- commandServer = nil
- propagateStatus(pb.CoreState_STOPPED)
- return C.CString("")
+ _, err := v2.Stop()
+ return emptyOrErrorC(err)
}
//export restart
func restart(configPath *C.char, disableMemoryLimit bool) (CErr *C.char) {
- defer config.DeferPanicToError("restart", func(err error) {
- stopAndAlert("Unexpected Error!", err)
- CErr = C.CString(err.Error())
+
+ _, err := v2.Restart(&pb.StartRequest{
+ ConfigPath: C.GoString(configPath),
+ EnableOldCommandServer: true,
+ DisableMemoryLimit: disableMemoryLimit,
})
- log.Debug("[Service] Restarting")
-
- if v2.CoreState != pb.CoreState_STARTED {
- return C.CString("")
- }
- if v2.Box == nil {
- return C.CString("instance not found")
- }
-
- err := stop()
- if C.GoString(err) != "" {
- return err
- }
-
- propagateStatus(pb.CoreState_STARTING)
-
- time.Sleep(250 * time.Millisecond)
-
- path := C.GoString(configPath)
- activeConfigPath = &path
- libbox.SetMemoryLimit(!disableMemoryLimit)
- gErr := startService(false)
- if gErr != nil {
- return C.CString(gErr.Error())
- }
- return C.CString("")
+ return emptyOrErrorC(err)
}
//export startCommandClient
func startCommandClient(command C.int, port C.longlong) *C.char {
- err := StartCommand(int32(command), int64(port), *logFactory)
- if err != nil {
- return C.CString(err.Error())
- }
- return C.CString("")
+ err := v2.StartCommand(int32(command), int64(port))
+ return emptyOrErrorC(err)
}
//export stopCommandClient
func stopCommandClient(command C.int) *C.char {
- err := StopCommand(int32(command))
- if err != nil {
- return C.CString(err.Error())
- }
- return C.CString("")
+ err := v2.StopCommand(int32(command))
+ return emptyOrErrorC(err)
}
//export selectOutbound
func selectOutbound(groupTag *C.char, outboundTag *C.char) (CErr *C.char) {
- defer config.DeferPanicToError("selectOutbound", func(err error) {
- CErr = C.CString(err.Error())
+
+ _, err := v2.SelectOutbound(&pb.SelectOutboundRequest{
+ GroupTag: C.GoString(groupTag),
+ OutboundTag: C.GoString(outboundTag),
})
- err := libbox.NewStandaloneCommandClient().SelectOutbound(C.GoString(groupTag), C.GoString(outboundTag))
- if err != nil {
- return C.CString(err.Error())
- }
- return C.CString("")
+ return emptyOrErrorC(err)
}
//export urlTest
func urlTest(groupTag *C.char) (CErr *C.char) {
- defer config.DeferPanicToError("urlTest", func(err error) {
- CErr = C.CString(err.Error())
+ _, err := v2.UrlTest(&pb.UrlTestRequest{
+ GroupTag: C.GoString(groupTag),
})
- err := libbox.NewStandaloneCommandClient().URLTest(C.GoString(groupTag))
- if err != nil {
- return C.CString(err.Error())
+ return emptyOrErrorC(err)
+}
+
+func emptyOrErrorC(err error) *C.char {
+ if err == nil {
+ return C.CString("")
}
- return C.CString("")
+ log.Error(err.Error())
+ return C.CString(err.Error())
}
//export generateWarpConfig
func generateWarpConfig(licenseKey *C.char, accountId *C.char, accessToken *C.char) (CResp *C.char) {
- defer config.DeferPanicToError("generateWarpConfig", func(err error) {
- CResp = C.CString(fmt.Sprint("error: ", err.Error()))
+ res, err := v2.GenerateWarpConfig(&pb.GenerateWarpConfigRequest{
+ LicenseKey: C.GoString(licenseKey),
+ AccountId: C.GoString(accountId),
+ AccessToken: C.GoString(accessToken),
})
- account, err := config.GenerateWarpAccount(C.GoString(licenseKey), C.GoString(accountId), C.GoString(accessToken))
+
if err != nil {
return C.CString(fmt.Sprint("error: ", err.Error()))
}
- return C.CString(account)
+ warpAccount := config.WarpAccount{
+ AccountID: res.Account.AccountId,
+ AccessToken: res.Account.AccessToken,
+ }
+ warpConfig := config.WarpWireguardConfig{
+ PrivateKey: res.Config.PrivateKey,
+ LocalAddressIPv4: res.Config.LocalAddressIpv4,
+ LocalAddressIPv6: res.Config.LocalAddressIpv6,
+ PeerPublicKey: res.Config.PeerPublicKey,
+ }
+ log := res.Log
+ response := &config.WarpGenerationResponse{
+ WarpAccount: warpAccount,
+ Log: log,
+ Config: warpConfig,
+ }
+
+ responseJson, err := json.Marshal(response)
+ if err != nil {
+ return C.CString("")
+ }
+ return C.CString(string(responseJson))
+
}
func main() {}
diff --git a/custom/grpc_interface.go b/custom/grpc_interface.go
new file mode 100644
index 0000000..af85ffb
--- /dev/null
+++ b/custom/grpc_interface.go
@@ -0,0 +1,10 @@
+package main
+
+import "C"
+import v2 "github.com/hiddify/libcore/v2"
+
+//export StartCoreGrpcServer
+func StartCoreGrpcServer(listenAddress *C.char) (CErr *C.char) {
+ err := v2.StartCoreGrpcServer(C.GoString(listenAddress))
+ return emptyOrErrorC(err)
+}
diff --git a/custom/service.go b/custom/service.go
deleted file mode 100644
index 0258a5a..0000000
--- a/custom/service.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package main
-
-import (
- "context"
- "os"
- "runtime"
- runtimeDebug "runtime/debug"
-
- B "github.com/sagernet/sing-box"
- "github.com/sagernet/sing-box/common/urltest"
- "github.com/sagernet/sing-box/experimental/libbox"
- "github.com/sagernet/sing-box/option"
- E "github.com/sagernet/sing/common/exceptions"
- "github.com/sagernet/sing/service"
- "github.com/sagernet/sing/service/filemanager"
- "github.com/sagernet/sing/service/pause"
-)
-
-var (
- sWorkingPath string
- sTempPath string
- sUserID int
- sGroupID int
-)
-
-func Setup(basePath string, workingPath string, tempPath string) {
- tcpConn := runtime.GOOS == "windows" //TODO add TVOS
- libbox.Setup(basePath, workingPath, tempPath, tcpConn)
- sWorkingPath = workingPath
- os.Chdir(sWorkingPath)
- sTempPath = tempPath
- sUserID = os.Getuid()
- sGroupID = os.Getgid()
-}
-
-func NewService(options option.Options) (*libbox.BoxService, error) {
- runtimeDebug.FreeOSMemory()
- ctx, cancel := context.WithCancel(context.Background())
- ctx = filemanager.WithDefault(ctx, sWorkingPath, sTempPath, sUserID, sGroupID)
- urlTestHistoryStorage := urltest.NewHistoryStorage()
- ctx = service.ContextWithPtr(ctx, urlTestHistoryStorage)
- instance, err := B.New(B.Options{
- Context: ctx,
- Options: options,
- })
- if err != nil {
- cancel()
- return nil, E.Cause(err, "create service")
- }
- runtimeDebug.FreeOSMemory()
- service := libbox.NewBoxService(
- ctx,
- cancel,
- instance,
- service.FromContext[pause.Manager](ctx),
- urlTestHistoryStorage,
- )
- return &service, nil
-}
-
-func parseConfig(configContent string) (option.Options, error) {
- var options option.Options
- err := options.UnmarshalJSON([]byte(configContent))
- if err != nil {
- return option.Options{}, E.Cause(err, "decode config")
- }
- return options, nil
-}
diff --git a/custom/status.go b/custom/status.go
deleted file mode 100644
index 573cf55..0000000
--- a/custom/status.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package main
-
-import "C"
-import (
- "encoding/json"
- "fmt"
-
- "github.com/hiddify/libcore/bridge"
- "github.com/hiddify/libcore/config"
- pb "github.com/hiddify/libcore/hiddifyrpc"
- v2 "github.com/hiddify/libcore/v2"
-)
-
-var statusPropagationPort int64
-
-// var status = Stopped
-
-type StatusMessage struct {
- Status string `json:"status"`
- Alert *string `json:"alert"`
- Message *string `json:"message"`
-}
-
-func propagateStatus(newStatus pb.CoreState) {
- v2.CoreState = newStatus
-
- msg, _ := json.Marshal(StatusMessage{Status: convert2OldState(v2.CoreState)})
- bridge.SendStringToPort(statusPropagationPort, string(msg))
-}
-
-func convert2OldState(newStatus pb.CoreState) string {
- if newStatus == pb.CoreState_STOPPED {
- return Stopped
- }
- if newStatus == pb.CoreState_STARTED {
- return Started
- }
- if newStatus == pb.CoreState_STARTING {
- return Starting
- }
- if newStatus == pb.CoreState_STOPPING {
- return Stopping
- }
- return "Invalid"
-}
-
-func stopAndAlert(alert string, err error) (resultErr error) {
- defer config.DeferPanicToError("stopAndAlert", func(err error) {
- resultErr = err
- })
- v2.CoreState = pb.CoreState_STOPPED
- message := err.Error()
- fmt.Printf("Error: %s: %s\n", alert, message)
- msg, _ := json.Marshal(StatusMessage{Status: convert2OldState(v2.CoreState), Alert: &alert, Message: &message})
- bridge.SendStringToPort(statusPropagationPort, string(msg))
-
- go config.DeactivateTunnelService()
- if commandServer != nil {
- commandServer.SetService(nil)
- }
- if v2.Box != nil {
- v2.Box.Close()
- v2.Box = nil
- }
- if commandServer != nil {
- commandServer.Close()
- }
- return nil
-}
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 2f670cf..f9155e8 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,6 +1,6 @@
FROM alpine:latest
ENV CONFIG='https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)'
-ENV VERSION=v0.17.8
+ENV VERSION=v0.17.9.dev
WORKDIR /hiddify
RUN apk add curl tar gzip libc6-compat # iptables ip6tables
diff --git a/hiddifyrpc/hiddify.pb.go b/hiddifyrpc/hiddify.pb.go
index 5fdcd62..a05c474 100644
--- a/hiddifyrpc/hiddify.pb.go
+++ b/hiddifyrpc/hiddify.pb.go
@@ -199,6 +199,34 @@ func (LogType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_b52c484803f63ee3, []int{4}
}
+type StackType int32
+
+const (
+ StackType_SYSTEM StackType = 0
+ StackType_GVISOR StackType = 1
+ StackType_MIXED StackType = 2
+)
+
+var StackType_name = map[int32]string{
+ 0: "SYSTEM",
+ 1: "GVISOR",
+ 2: "MIXED",
+}
+
+var StackType_value = map[string]int32{
+ "SYSTEM": 0,
+ "GVISOR": 1,
+ "MIXED": 2,
+}
+
+func (x StackType) String() string {
+ return proto.EnumName(StackType_name, int32(x))
+}
+
+func (StackType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_b52c484803f63ee3, []int{5}
+}
+
type CoreInfoResponse struct {
CoreState CoreState `protobuf:"varint,1,opt,name=core_state,json=coreState,proto3,enum=hiddifyrpc.CoreState" json:"core_state,omitempty"`
MessageType MessageType `protobuf:"varint,2,opt,name=message_type,json=messageType,proto3,enum=hiddifyrpc.MessageType" json:"message_type,omitempty"`
@@ -255,13 +283,14 @@ func (m *CoreInfoResponse) GetMessage() string {
}
type StartRequest struct {
- ConfigPath string `protobuf:"bytes,1,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"`
- ConfigContent string `protobuf:"bytes,2,opt,name=config_content,json=configContent,proto3" json:"config_content,omitempty"`
- DisableMemoryLimit bool `protobuf:"varint,3,opt,name=disable_memory_limit,json=disableMemoryLimit,proto3" json:"disable_memory_limit,omitempty"`
- DelayStart bool `protobuf:"varint,4,opt,name=delay_start,json=delayStart,proto3" json:"delay_start,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
+ ConfigPath string `protobuf:"bytes,1,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"`
+ ConfigContent string `protobuf:"bytes,2,opt,name=config_content,json=configContent,proto3" json:"config_content,omitempty"`
+ DisableMemoryLimit bool `protobuf:"varint,3,opt,name=disable_memory_limit,json=disableMemoryLimit,proto3" json:"disable_memory_limit,omitempty"`
+ DelayStart bool `protobuf:"varint,4,opt,name=delay_start,json=delayStart,proto3" json:"delay_start,omitempty"`
+ EnableOldCommandServer bool `protobuf:"varint,5,opt,name=enable_old_command_server,json=enableOldCommandServer,proto3" json:"enable_old_command_server,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
}
func (m *StartRequest) Reset() { *m = StartRequest{} }
@@ -317,6 +346,13 @@ func (m *StartRequest) GetDelayStart() bool {
return false
}
+func (m *StartRequest) GetEnableOldCommandServer() bool {
+ if m != nil {
+ return m.EnableOldCommandServer
+ }
+ return false
+}
+
type SetupRequest struct {
BasePath string `protobuf:"bytes,1,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"`
WorkingPath string `protobuf:"bytes,2,opt,name=working_path,json=workingPath,proto3" json:"working_path,omitempty"`
@@ -1010,7 +1046,9 @@ func (m *SystemProxyStatus) GetEnabled() bool {
type ParseRequest struct {
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
- Debug bool `protobuf:"varint,2,opt,name=debug,proto3" json:"debug,omitempty"`
+ ConfigPath string `protobuf:"bytes,2,opt,name=config_path,json=configPath,proto3" json:"config_path,omitempty"`
+ TempPath string `protobuf:"bytes,3,opt,name=temp_path,json=tempPath,proto3" json:"temp_path,omitempty"`
+ Debug bool `protobuf:"varint,4,opt,name=debug,proto3" json:"debug,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -1048,6 +1086,20 @@ func (m *ParseRequest) GetContent() string {
return ""
}
+func (m *ParseRequest) GetConfigPath() string {
+ if m != nil {
+ return m.ConfigPath
+ }
+ return ""
+}
+
+func (m *ParseRequest) GetTempPath() string {
+ if m != nil {
+ return m.TempPath
+ }
+ return ""
+}
+
func (m *ParseRequest) GetDebug() bool {
if m != nil {
return m.Debug
@@ -1509,12 +1561,123 @@ func (m *StopRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_StopRequest proto.InternalMessageInfo
+type TunnelStartRequest struct {
+ Ipv6 bool `protobuf:"varint,1,opt,name=ipv6,proto3" json:"ipv6,omitempty"`
+ ServerPort int32 `protobuf:"varint,2,opt,name=server_port,json=serverPort,proto3" json:"server_port,omitempty"`
+ StrictRoute bool `protobuf:"varint,3,opt,name=strict_route,json=strictRoute,proto3" json:"strict_route,omitempty"`
+ EndpointIndependentNat bool `protobuf:"varint,4,opt,name=endpoint_independent_nat,json=endpointIndependentNat,proto3" json:"endpoint_independent_nat,omitempty"`
+ Stack StackType `protobuf:"varint,5,opt,name=stack,proto3,enum=hiddifyrpc.StackType" json:"stack,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *TunnelStartRequest) Reset() { *m = TunnelStartRequest{} }
+func (m *TunnelStartRequest) String() string { return proto.CompactTextString(m) }
+func (*TunnelStartRequest) ProtoMessage() {}
+func (*TunnelStartRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_b52c484803f63ee3, []int{26}
+}
+
+func (m *TunnelStartRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_TunnelStartRequest.Unmarshal(m, b)
+}
+func (m *TunnelStartRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_TunnelStartRequest.Marshal(b, m, deterministic)
+}
+func (m *TunnelStartRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_TunnelStartRequest.Merge(m, src)
+}
+func (m *TunnelStartRequest) XXX_Size() int {
+ return xxx_messageInfo_TunnelStartRequest.Size(m)
+}
+func (m *TunnelStartRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_TunnelStartRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_TunnelStartRequest proto.InternalMessageInfo
+
+func (m *TunnelStartRequest) GetIpv6() bool {
+ if m != nil {
+ return m.Ipv6
+ }
+ return false
+}
+
+func (m *TunnelStartRequest) GetServerPort() int32 {
+ if m != nil {
+ return m.ServerPort
+ }
+ return 0
+}
+
+func (m *TunnelStartRequest) GetStrictRoute() bool {
+ if m != nil {
+ return m.StrictRoute
+ }
+ return false
+}
+
+func (m *TunnelStartRequest) GetEndpointIndependentNat() bool {
+ if m != nil {
+ return m.EndpointIndependentNat
+ }
+ return false
+}
+
+func (m *TunnelStartRequest) GetStack() StackType {
+ if m != nil {
+ return m.Stack
+ }
+ return StackType_SYSTEM
+}
+
+type TunnelResponse struct {
+ Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *TunnelResponse) Reset() { *m = TunnelResponse{} }
+func (m *TunnelResponse) String() string { return proto.CompactTextString(m) }
+func (*TunnelResponse) ProtoMessage() {}
+func (*TunnelResponse) Descriptor() ([]byte, []int) {
+ return fileDescriptor_b52c484803f63ee3, []int{27}
+}
+
+func (m *TunnelResponse) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_TunnelResponse.Unmarshal(m, b)
+}
+func (m *TunnelResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_TunnelResponse.Marshal(b, m, deterministic)
+}
+func (m *TunnelResponse) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_TunnelResponse.Merge(m, src)
+}
+func (m *TunnelResponse) XXX_Size() int {
+ return xxx_messageInfo_TunnelResponse.Size(m)
+}
+func (m *TunnelResponse) XXX_DiscardUnknown() {
+ xxx_messageInfo_TunnelResponse.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_TunnelResponse proto.InternalMessageInfo
+
+func (m *TunnelResponse) GetMessage() string {
+ if m != nil {
+ return m.Message
+ }
+ return ""
+}
+
func init() {
proto.RegisterEnum("hiddifyrpc.ResponseCode", ResponseCode_name, ResponseCode_value)
proto.RegisterEnum("hiddifyrpc.CoreState", CoreState_name, CoreState_value)
proto.RegisterEnum("hiddifyrpc.MessageType", MessageType_name, MessageType_value)
proto.RegisterEnum("hiddifyrpc.LogLevel", LogLevel_name, LogLevel_value)
proto.RegisterEnum("hiddifyrpc.LogType", LogType_name, LogType_value)
+ proto.RegisterEnum("hiddifyrpc.StackType", StackType_name, StackType_value)
proto.RegisterType((*CoreInfoResponse)(nil), "hiddifyrpc.CoreInfoResponse")
proto.RegisterType((*StartRequest)(nil), "hiddifyrpc.StartRequest")
proto.RegisterType((*SetupRequest)(nil), "hiddifyrpc.SetupRequest")
@@ -1541,122 +1704,139 @@ func init() {
proto.RegisterType((*SetSystemProxyEnabledRequest)(nil), "hiddifyrpc.SetSystemProxyEnabledRequest")
proto.RegisterType((*LogMessage)(nil), "hiddifyrpc.LogMessage")
proto.RegisterType((*StopRequest)(nil), "hiddifyrpc.StopRequest")
+ proto.RegisterType((*TunnelStartRequest)(nil), "hiddifyrpc.TunnelStartRequest")
+ proto.RegisterType((*TunnelResponse)(nil), "hiddifyrpc.TunnelResponse")
}
func init() { proto.RegisterFile("hiddifyrpc/hiddify.proto", fileDescriptor_b52c484803f63ee3) }
var fileDescriptor_b52c484803f63ee3 = []byte{
- // 1783 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x18, 0x5d, 0x73, 0xe3, 0x56,
- 0x35, 0xb2, 0xe3, 0xd8, 0x3e, 0xb6, 0xb3, 0xca, 0x4d, 0x36, 0xeb, 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, 0x17, 0x00, 0x00, 0xff,
+ 0xff, 0x17, 0x3d, 0x94, 0x57, 0x0e, 0x15, 0x00, 0x00,
}
diff --git a/hiddifyrpc/hiddify.proto b/hiddifyrpc/hiddify.proto
index aadeaa3..e2cc899 100644
--- a/hiddifyrpc/hiddify.proto
+++ b/hiddifyrpc/hiddify.proto
@@ -44,6 +44,7 @@ message StartRequest {
string config_content = 2; // Optional if configPath is not provided.
bool disable_memory_limit = 3;
bool delay_start = 4;
+ bool enable_old_command_server = 5;
}
message SetupRequest {
@@ -123,8 +124,10 @@ message SystemProxyStatus {
}
message ParseRequest {
- string content = 1;
- bool debug = 2;
+ string content = 1;
+ string config_path = 2;
+ string temp_path = 3;
+ bool debug = 4;
}
message ParseResponse {
@@ -189,9 +192,31 @@ message LogMessage {
message StopRequest{
}
-service Hiddify {
+
+enum StackType {
+ SYSTEM = 0;
+ GVISOR = 1;
+ MIXED = 2;
+
+}
+
+message TunnelStartRequest {
+ bool ipv6 = 1;
+ int32 server_port = 2;
+ bool strict_route = 3;
+ bool endpoint_independent_nat = 4;
+ StackType stack = 5;
+}
+
+message TunnelResponse {
+ string message = 1;
+}
+
+service Hello {
rpc SayHello (HelloRequest) returns (HelloResponse);
rpc SayHelloStream (stream HelloRequest) returns (stream HelloResponse);
+}
+service Core {
rpc Start (StartRequest) returns (CoreInfoResponse);
rpc CoreInfoListener (stream StopRequest) returns (stream CoreInfoResponse);
rpc OutboundsInfo (stream StopRequest) returns (stream OutboundGroupList);
@@ -199,7 +224,7 @@ service Hiddify {
rpc GetSystemInfo (stream StopRequest) returns (stream SystemInfo);
rpc Setup (SetupRequest) returns (Response);
rpc Parse (ParseRequest) returns (ParseResponse);
- //rpc ChangeConfigOptions (ChangeConfigOptionsRequest) returns (CoreInfoResponse);
+ rpc ChangeConfigOptions (ChangeConfigOptionsRequest) returns (CoreInfoResponse);
//rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse);
rpc StartService (StartRequest) returns (CoreInfoResponse);
rpc Stop (Empty) returns (CoreInfoResponse);
@@ -209,6 +234,14 @@ service Hiddify {
rpc GenerateWarpConfig (GenerateWarpConfigRequest) returns (WarpGenerationResponse);
rpc GetSystemProxyStatus (Empty) returns (SystemProxyStatus);
rpc SetSystemProxyEnabled (SetSystemProxyEnabledRequest) returns (Response);
- rpc LogListener (stream StopRequest) returns (stream LogMessage);
-
+ rpc LogListener (stream StopRequest) returns (stream LogMessage);
}
+
+
+
+service TunnelService {
+ rpc Start(StartRequest) returns (TunnelResponse);
+ rpc Stop(Empty) returns (TunnelResponse);
+ rpc Status(Empty) returns (TunnelResponse);
+ rpc Exit(Empty) returns (TunnelResponse);
+}
\ No newline at end of file
diff --git a/hiddifyrpc/hiddify_grpc.pb.go b/hiddifyrpc/hiddify_grpc.pb.go
index 1672d83..af293be 100644
--- a/hiddifyrpc/hiddify_grpc.pb.go
+++ b/hiddifyrpc/hiddify_grpc.pb.go
@@ -19,40 +19,197 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
- Hiddify_SayHello_FullMethodName = "/hiddifyrpc.Hiddify/SayHello"
- Hiddify_SayHelloStream_FullMethodName = "/hiddifyrpc.Hiddify/SayHelloStream"
- Hiddify_Start_FullMethodName = "/hiddifyrpc.Hiddify/Start"
- Hiddify_CoreInfoListener_FullMethodName = "/hiddifyrpc.Hiddify/CoreInfoListener"
- Hiddify_OutboundsInfo_FullMethodName = "/hiddifyrpc.Hiddify/OutboundsInfo"
- Hiddify_MainOutboundsInfo_FullMethodName = "/hiddifyrpc.Hiddify/MainOutboundsInfo"
- Hiddify_GetSystemInfo_FullMethodName = "/hiddifyrpc.Hiddify/GetSystemInfo"
- Hiddify_Setup_FullMethodName = "/hiddifyrpc.Hiddify/Setup"
- Hiddify_Parse_FullMethodName = "/hiddifyrpc.Hiddify/Parse"
- Hiddify_StartService_FullMethodName = "/hiddifyrpc.Hiddify/StartService"
- Hiddify_Stop_FullMethodName = "/hiddifyrpc.Hiddify/Stop"
- Hiddify_Restart_FullMethodName = "/hiddifyrpc.Hiddify/Restart"
- Hiddify_SelectOutbound_FullMethodName = "/hiddifyrpc.Hiddify/SelectOutbound"
- Hiddify_UrlTest_FullMethodName = "/hiddifyrpc.Hiddify/UrlTest"
- Hiddify_GenerateWarpConfig_FullMethodName = "/hiddifyrpc.Hiddify/GenerateWarpConfig"
- Hiddify_GetSystemProxyStatus_FullMethodName = "/hiddifyrpc.Hiddify/GetSystemProxyStatus"
- Hiddify_SetSystemProxyEnabled_FullMethodName = "/hiddifyrpc.Hiddify/SetSystemProxyEnabled"
- Hiddify_LogListener_FullMethodName = "/hiddifyrpc.Hiddify/LogListener"
+ Hello_SayHello_FullMethodName = "/hiddifyrpc.Hello/SayHello"
+ Hello_SayHelloStream_FullMethodName = "/hiddifyrpc.Hello/SayHelloStream"
)
-// HiddifyClient is the client API for Hiddify service.
+// HelloClient is the client API for Hello service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type HiddifyClient interface {
+type HelloClient interface {
SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error)
- SayHelloStream(ctx context.Context, opts ...grpc.CallOption) (Hiddify_SayHelloStreamClient, error)
+ SayHelloStream(ctx context.Context, opts ...grpc.CallOption) (Hello_SayHelloStreamClient, error)
+}
+
+type helloClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewHelloClient(cc grpc.ClientConnInterface) HelloClient {
+ return &helloClient{cc}
+}
+
+func (c *helloClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) {
+ out := new(HelloResponse)
+ err := c.cc.Invoke(ctx, Hello_SayHello_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *helloClient) SayHelloStream(ctx context.Context, opts ...grpc.CallOption) (Hello_SayHelloStreamClient, error) {
+ stream, err := c.cc.NewStream(ctx, &Hello_ServiceDesc.Streams[0], Hello_SayHelloStream_FullMethodName, opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &helloSayHelloStreamClient{stream}
+ return x, nil
+}
+
+type Hello_SayHelloStreamClient interface {
+ Send(*HelloRequest) error
+ Recv() (*HelloResponse, error)
+ grpc.ClientStream
+}
+
+type helloSayHelloStreamClient struct {
+ grpc.ClientStream
+}
+
+func (x *helloSayHelloStreamClient) Send(m *HelloRequest) error {
+ return x.ClientStream.SendMsg(m)
+}
+
+func (x *helloSayHelloStreamClient) Recv() (*HelloResponse, error) {
+ m := new(HelloResponse)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+// HelloServer is the server API for Hello service.
+// All implementations must embed UnimplementedHelloServer
+// for forward compatibility
+type HelloServer interface {
+ SayHello(context.Context, *HelloRequest) (*HelloResponse, error)
+ SayHelloStream(Hello_SayHelloStreamServer) error
+ mustEmbedUnimplementedHelloServer()
+}
+
+// UnimplementedHelloServer must be embedded to have forward compatible implementations.
+type UnimplementedHelloServer struct {
+}
+
+func (UnimplementedHelloServer) SayHello(context.Context, *HelloRequest) (*HelloResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
+}
+func (UnimplementedHelloServer) SayHelloStream(Hello_SayHelloStreamServer) error {
+ return status.Errorf(codes.Unimplemented, "method SayHelloStream not implemented")
+}
+func (UnimplementedHelloServer) mustEmbedUnimplementedHelloServer() {}
+
+// UnsafeHelloServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to HelloServer will
+// result in compilation errors.
+type UnsafeHelloServer interface {
+ mustEmbedUnimplementedHelloServer()
+}
+
+func RegisterHelloServer(s grpc.ServiceRegistrar, srv HelloServer) {
+ s.RegisterService(&Hello_ServiceDesc, srv)
+}
+
+func _Hello_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(HelloRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(HelloServer).SayHello(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Hello_SayHello_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(HelloServer).SayHello(ctx, req.(*HelloRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Hello_SayHelloStream_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(HelloServer).SayHelloStream(&helloSayHelloStreamServer{stream})
+}
+
+type Hello_SayHelloStreamServer interface {
+ Send(*HelloResponse) error
+ Recv() (*HelloRequest, error)
+ grpc.ServerStream
+}
+
+type helloSayHelloStreamServer struct {
+ grpc.ServerStream
+}
+
+func (x *helloSayHelloStreamServer) Send(m *HelloResponse) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func (x *helloSayHelloStreamServer) Recv() (*HelloRequest, error) {
+ m := new(HelloRequest)
+ if err := x.ServerStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+// Hello_ServiceDesc is the grpc.ServiceDesc for Hello service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Hello_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "hiddifyrpc.Hello",
+ HandlerType: (*HelloServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SayHello",
+ Handler: _Hello_SayHello_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{
+ {
+ StreamName: "SayHelloStream",
+ Handler: _Hello_SayHelloStream_Handler,
+ ServerStreams: true,
+ ClientStreams: true,
+ },
+ },
+ Metadata: "hiddifyrpc/hiddify.proto",
+}
+
+const (
+ Core_Start_FullMethodName = "/hiddifyrpc.Core/Start"
+ Core_CoreInfoListener_FullMethodName = "/hiddifyrpc.Core/CoreInfoListener"
+ Core_OutboundsInfo_FullMethodName = "/hiddifyrpc.Core/OutboundsInfo"
+ Core_MainOutboundsInfo_FullMethodName = "/hiddifyrpc.Core/MainOutboundsInfo"
+ Core_GetSystemInfo_FullMethodName = "/hiddifyrpc.Core/GetSystemInfo"
+ Core_Setup_FullMethodName = "/hiddifyrpc.Core/Setup"
+ Core_Parse_FullMethodName = "/hiddifyrpc.Core/Parse"
+ Core_ChangeConfigOptions_FullMethodName = "/hiddifyrpc.Core/ChangeConfigOptions"
+ Core_StartService_FullMethodName = "/hiddifyrpc.Core/StartService"
+ Core_Stop_FullMethodName = "/hiddifyrpc.Core/Stop"
+ Core_Restart_FullMethodName = "/hiddifyrpc.Core/Restart"
+ Core_SelectOutbound_FullMethodName = "/hiddifyrpc.Core/SelectOutbound"
+ Core_UrlTest_FullMethodName = "/hiddifyrpc.Core/UrlTest"
+ Core_GenerateWarpConfig_FullMethodName = "/hiddifyrpc.Core/GenerateWarpConfig"
+ Core_GetSystemProxyStatus_FullMethodName = "/hiddifyrpc.Core/GetSystemProxyStatus"
+ Core_SetSystemProxyEnabled_FullMethodName = "/hiddifyrpc.Core/SetSystemProxyEnabled"
+ Core_LogListener_FullMethodName = "/hiddifyrpc.Core/LogListener"
+)
+
+// CoreClient is the client API for Core service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type CoreClient interface {
Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error)
- CoreInfoListener(ctx context.Context, opts ...grpc.CallOption) (Hiddify_CoreInfoListenerClient, error)
- OutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Hiddify_OutboundsInfoClient, error)
- MainOutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Hiddify_MainOutboundsInfoClient, error)
- GetSystemInfo(ctx context.Context, opts ...grpc.CallOption) (Hiddify_GetSystemInfoClient, error)
+ CoreInfoListener(ctx context.Context, opts ...grpc.CallOption) (Core_CoreInfoListenerClient, error)
+ OutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Core_OutboundsInfoClient, error)
+ MainOutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Core_MainOutboundsInfoClient, error)
+ GetSystemInfo(ctx context.Context, opts ...grpc.CallOption) (Core_GetSystemInfoClient, error)
Setup(ctx context.Context, in *SetupRequest, opts ...grpc.CallOption) (*Response, error)
Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
- //rpc ChangeConfigOptions (ChangeConfigOptionsRequest) returns (CoreInfoResponse);
+ ChangeConfigOptions(ctx context.Context, in *ChangeConfigOptionsRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error)
//rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse);
StartService(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error)
Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CoreInfoResponse, error)
@@ -62,90 +219,50 @@ type HiddifyClient interface {
GenerateWarpConfig(ctx context.Context, in *GenerateWarpConfigRequest, opts ...grpc.CallOption) (*WarpGenerationResponse, error)
GetSystemProxyStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SystemProxyStatus, error)
SetSystemProxyEnabled(ctx context.Context, in *SetSystemProxyEnabledRequest, opts ...grpc.CallOption) (*Response, error)
- LogListener(ctx context.Context, opts ...grpc.CallOption) (Hiddify_LogListenerClient, error)
+ LogListener(ctx context.Context, opts ...grpc.CallOption) (Core_LogListenerClient, error)
}
-type hiddifyClient struct {
+type coreClient struct {
cc grpc.ClientConnInterface
}
-func NewHiddifyClient(cc grpc.ClientConnInterface) HiddifyClient {
- return &hiddifyClient{cc}
+func NewCoreClient(cc grpc.ClientConnInterface) CoreClient {
+ return &coreClient{cc}
}
-func (c *hiddifyClient) SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) {
- out := new(HelloResponse)
- err := c.cc.Invoke(ctx, Hiddify_SayHello_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *hiddifyClient) SayHelloStream(ctx context.Context, opts ...grpc.CallOption) (Hiddify_SayHelloStreamClient, error) {
- stream, err := c.cc.NewStream(ctx, &Hiddify_ServiceDesc.Streams[0], Hiddify_SayHelloStream_FullMethodName, opts...)
- if err != nil {
- return nil, err
- }
- x := &hiddifySayHelloStreamClient{stream}
- return x, nil
-}
-
-type Hiddify_SayHelloStreamClient interface {
- Send(*HelloRequest) error
- Recv() (*HelloResponse, error)
- grpc.ClientStream
-}
-
-type hiddifySayHelloStreamClient struct {
- grpc.ClientStream
-}
-
-func (x *hiddifySayHelloStreamClient) Send(m *HelloRequest) error {
- return x.ClientStream.SendMsg(m)
-}
-
-func (x *hiddifySayHelloStreamClient) Recv() (*HelloResponse, error) {
- m := new(HelloResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func (c *hiddifyClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
+func (c *coreClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
out := new(CoreInfoResponse)
- err := c.cc.Invoke(ctx, Hiddify_Start_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_Start_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) CoreInfoListener(ctx context.Context, opts ...grpc.CallOption) (Hiddify_CoreInfoListenerClient, error) {
- stream, err := c.cc.NewStream(ctx, &Hiddify_ServiceDesc.Streams[1], Hiddify_CoreInfoListener_FullMethodName, opts...)
+func (c *coreClient) CoreInfoListener(ctx context.Context, opts ...grpc.CallOption) (Core_CoreInfoListenerClient, error) {
+ stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[0], Core_CoreInfoListener_FullMethodName, opts...)
if err != nil {
return nil, err
}
- x := &hiddifyCoreInfoListenerClient{stream}
+ x := &coreCoreInfoListenerClient{stream}
return x, nil
}
-type Hiddify_CoreInfoListenerClient interface {
+type Core_CoreInfoListenerClient interface {
Send(*StopRequest) error
Recv() (*CoreInfoResponse, error)
grpc.ClientStream
}
-type hiddifyCoreInfoListenerClient struct {
+type coreCoreInfoListenerClient struct {
grpc.ClientStream
}
-func (x *hiddifyCoreInfoListenerClient) Send(m *StopRequest) error {
+func (x *coreCoreInfoListenerClient) Send(m *StopRequest) error {
return x.ClientStream.SendMsg(m)
}
-func (x *hiddifyCoreInfoListenerClient) Recv() (*CoreInfoResponse, error) {
+func (x *coreCoreInfoListenerClient) Recv() (*CoreInfoResponse, error) {
m := new(CoreInfoResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
@@ -153,30 +270,30 @@ func (x *hiddifyCoreInfoListenerClient) Recv() (*CoreInfoResponse, error) {
return m, nil
}
-func (c *hiddifyClient) OutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Hiddify_OutboundsInfoClient, error) {
- stream, err := c.cc.NewStream(ctx, &Hiddify_ServiceDesc.Streams[2], Hiddify_OutboundsInfo_FullMethodName, opts...)
+func (c *coreClient) OutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Core_OutboundsInfoClient, error) {
+ stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[1], Core_OutboundsInfo_FullMethodName, opts...)
if err != nil {
return nil, err
}
- x := &hiddifyOutboundsInfoClient{stream}
+ x := &coreOutboundsInfoClient{stream}
return x, nil
}
-type Hiddify_OutboundsInfoClient interface {
+type Core_OutboundsInfoClient interface {
Send(*StopRequest) error
Recv() (*OutboundGroupList, error)
grpc.ClientStream
}
-type hiddifyOutboundsInfoClient struct {
+type coreOutboundsInfoClient struct {
grpc.ClientStream
}
-func (x *hiddifyOutboundsInfoClient) Send(m *StopRequest) error {
+func (x *coreOutboundsInfoClient) Send(m *StopRequest) error {
return x.ClientStream.SendMsg(m)
}
-func (x *hiddifyOutboundsInfoClient) Recv() (*OutboundGroupList, error) {
+func (x *coreOutboundsInfoClient) Recv() (*OutboundGroupList, error) {
m := new(OutboundGroupList)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
@@ -184,30 +301,30 @@ func (x *hiddifyOutboundsInfoClient) Recv() (*OutboundGroupList, error) {
return m, nil
}
-func (c *hiddifyClient) MainOutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Hiddify_MainOutboundsInfoClient, error) {
- stream, err := c.cc.NewStream(ctx, &Hiddify_ServiceDesc.Streams[3], Hiddify_MainOutboundsInfo_FullMethodName, opts...)
+func (c *coreClient) MainOutboundsInfo(ctx context.Context, opts ...grpc.CallOption) (Core_MainOutboundsInfoClient, error) {
+ stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[2], Core_MainOutboundsInfo_FullMethodName, opts...)
if err != nil {
return nil, err
}
- x := &hiddifyMainOutboundsInfoClient{stream}
+ x := &coreMainOutboundsInfoClient{stream}
return x, nil
}
-type Hiddify_MainOutboundsInfoClient interface {
+type Core_MainOutboundsInfoClient interface {
Send(*StopRequest) error
Recv() (*OutboundGroupList, error)
grpc.ClientStream
}
-type hiddifyMainOutboundsInfoClient struct {
+type coreMainOutboundsInfoClient struct {
grpc.ClientStream
}
-func (x *hiddifyMainOutboundsInfoClient) Send(m *StopRequest) error {
+func (x *coreMainOutboundsInfoClient) Send(m *StopRequest) error {
return x.ClientStream.SendMsg(m)
}
-func (x *hiddifyMainOutboundsInfoClient) Recv() (*OutboundGroupList, error) {
+func (x *coreMainOutboundsInfoClient) Recv() (*OutboundGroupList, error) {
m := new(OutboundGroupList)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
@@ -215,30 +332,30 @@ func (x *hiddifyMainOutboundsInfoClient) Recv() (*OutboundGroupList, error) {
return m, nil
}
-func (c *hiddifyClient) GetSystemInfo(ctx context.Context, opts ...grpc.CallOption) (Hiddify_GetSystemInfoClient, error) {
- stream, err := c.cc.NewStream(ctx, &Hiddify_ServiceDesc.Streams[4], Hiddify_GetSystemInfo_FullMethodName, opts...)
+func (c *coreClient) GetSystemInfo(ctx context.Context, opts ...grpc.CallOption) (Core_GetSystemInfoClient, error) {
+ stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[3], Core_GetSystemInfo_FullMethodName, opts...)
if err != nil {
return nil, err
}
- x := &hiddifyGetSystemInfoClient{stream}
+ x := &coreGetSystemInfoClient{stream}
return x, nil
}
-type Hiddify_GetSystemInfoClient interface {
+type Core_GetSystemInfoClient interface {
Send(*StopRequest) error
Recv() (*SystemInfo, error)
grpc.ClientStream
}
-type hiddifyGetSystemInfoClient struct {
+type coreGetSystemInfoClient struct {
grpc.ClientStream
}
-func (x *hiddifyGetSystemInfoClient) Send(m *StopRequest) error {
+func (x *coreGetSystemInfoClient) Send(m *StopRequest) error {
return x.ClientStream.SendMsg(m)
}
-func (x *hiddifyGetSystemInfoClient) Recv() (*SystemInfo, error) {
+func (x *coreGetSystemInfoClient) Recv() (*SystemInfo, error) {
m := new(SystemInfo)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
@@ -246,120 +363,129 @@ func (x *hiddifyGetSystemInfoClient) Recv() (*SystemInfo, error) {
return m, nil
}
-func (c *hiddifyClient) Setup(ctx context.Context, in *SetupRequest, opts ...grpc.CallOption) (*Response, error) {
+func (c *coreClient) Setup(ctx context.Context, in *SetupRequest, opts ...grpc.CallOption) (*Response, error) {
out := new(Response)
- err := c.cc.Invoke(ctx, Hiddify_Setup_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_Setup_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) {
+func (c *coreClient) Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) {
out := new(ParseResponse)
- err := c.cc.Invoke(ctx, Hiddify_Parse_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_Parse_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) StartService(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
+func (c *coreClient) ChangeConfigOptions(ctx context.Context, in *ChangeConfigOptionsRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
out := new(CoreInfoResponse)
- err := c.cc.Invoke(ctx, Hiddify_StartService_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_ChangeConfigOptions_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
+func (c *coreClient) StartService(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
out := new(CoreInfoResponse)
- err := c.cc.Invoke(ctx, Hiddify_Stop_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_StartService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) Restart(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
+func (c *coreClient) Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
out := new(CoreInfoResponse)
- err := c.cc.Invoke(ctx, Hiddify_Restart_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_Stop_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) SelectOutbound(ctx context.Context, in *SelectOutboundRequest, opts ...grpc.CallOption) (*Response, error) {
+func (c *coreClient) Restart(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*CoreInfoResponse, error) {
+ out := new(CoreInfoResponse)
+ err := c.cc.Invoke(ctx, Core_Restart_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *coreClient) SelectOutbound(ctx context.Context, in *SelectOutboundRequest, opts ...grpc.CallOption) (*Response, error) {
out := new(Response)
- err := c.cc.Invoke(ctx, Hiddify_SelectOutbound_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_SelectOutbound_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) UrlTest(ctx context.Context, in *UrlTestRequest, opts ...grpc.CallOption) (*Response, error) {
+func (c *coreClient) UrlTest(ctx context.Context, in *UrlTestRequest, opts ...grpc.CallOption) (*Response, error) {
out := new(Response)
- err := c.cc.Invoke(ctx, Hiddify_UrlTest_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_UrlTest_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) GenerateWarpConfig(ctx context.Context, in *GenerateWarpConfigRequest, opts ...grpc.CallOption) (*WarpGenerationResponse, error) {
+func (c *coreClient) GenerateWarpConfig(ctx context.Context, in *GenerateWarpConfigRequest, opts ...grpc.CallOption) (*WarpGenerationResponse, error) {
out := new(WarpGenerationResponse)
- err := c.cc.Invoke(ctx, Hiddify_GenerateWarpConfig_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_GenerateWarpConfig_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) GetSystemProxyStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SystemProxyStatus, error) {
+func (c *coreClient) GetSystemProxyStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SystemProxyStatus, error) {
out := new(SystemProxyStatus)
- err := c.cc.Invoke(ctx, Hiddify_GetSystemProxyStatus_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_GetSystemProxyStatus_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) SetSystemProxyEnabled(ctx context.Context, in *SetSystemProxyEnabledRequest, opts ...grpc.CallOption) (*Response, error) {
+func (c *coreClient) SetSystemProxyEnabled(ctx context.Context, in *SetSystemProxyEnabledRequest, opts ...grpc.CallOption) (*Response, error) {
out := new(Response)
- err := c.cc.Invoke(ctx, Hiddify_SetSystemProxyEnabled_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, Core_SetSystemProxyEnabled_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *hiddifyClient) LogListener(ctx context.Context, opts ...grpc.CallOption) (Hiddify_LogListenerClient, error) {
- stream, err := c.cc.NewStream(ctx, &Hiddify_ServiceDesc.Streams[5], Hiddify_LogListener_FullMethodName, opts...)
+func (c *coreClient) LogListener(ctx context.Context, opts ...grpc.CallOption) (Core_LogListenerClient, error) {
+ stream, err := c.cc.NewStream(ctx, &Core_ServiceDesc.Streams[4], Core_LogListener_FullMethodName, opts...)
if err != nil {
return nil, err
}
- x := &hiddifyLogListenerClient{stream}
+ x := &coreLogListenerClient{stream}
return x, nil
}
-type Hiddify_LogListenerClient interface {
+type Core_LogListenerClient interface {
Send(*StopRequest) error
Recv() (*LogMessage, error)
grpc.ClientStream
}
-type hiddifyLogListenerClient struct {
+type coreLogListenerClient struct {
grpc.ClientStream
}
-func (x *hiddifyLogListenerClient) Send(m *StopRequest) error {
+func (x *coreLogListenerClient) Send(m *StopRequest) error {
return x.ClientStream.SendMsg(m)
}
-func (x *hiddifyLogListenerClient) Recv() (*LogMessage, error) {
+func (x *coreLogListenerClient) Recv() (*LogMessage, error) {
m := new(LogMessage)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
@@ -367,20 +493,18 @@ func (x *hiddifyLogListenerClient) Recv() (*LogMessage, error) {
return m, nil
}
-// HiddifyServer is the server API for Hiddify service.
-// All implementations must embed UnimplementedHiddifyServer
+// CoreServer is the server API for Core service.
+// All implementations must embed UnimplementedCoreServer
// for forward compatibility
-type HiddifyServer interface {
- SayHello(context.Context, *HelloRequest) (*HelloResponse, error)
- SayHelloStream(Hiddify_SayHelloStreamServer) error
+type CoreServer interface {
Start(context.Context, *StartRequest) (*CoreInfoResponse, error)
- CoreInfoListener(Hiddify_CoreInfoListenerServer) error
- OutboundsInfo(Hiddify_OutboundsInfoServer) error
- MainOutboundsInfo(Hiddify_MainOutboundsInfoServer) error
- GetSystemInfo(Hiddify_GetSystemInfoServer) error
+ CoreInfoListener(Core_CoreInfoListenerServer) error
+ OutboundsInfo(Core_OutboundsInfoServer) error
+ MainOutboundsInfo(Core_MainOutboundsInfoServer) error
+ GetSystemInfo(Core_GetSystemInfoServer) error
Setup(context.Context, *SetupRequest) (*Response, error)
Parse(context.Context, *ParseRequest) (*ParseResponse, error)
- //rpc ChangeConfigOptions (ChangeConfigOptionsRequest) returns (CoreInfoResponse);
+ ChangeConfigOptions(context.Context, *ChangeConfigOptionsRequest) (*CoreInfoResponse, error)
//rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse);
StartService(context.Context, *StartRequest) (*CoreInfoResponse, error)
Stop(context.Context, *Empty) (*CoreInfoResponse, error)
@@ -390,162 +514,115 @@ type HiddifyServer interface {
GenerateWarpConfig(context.Context, *GenerateWarpConfigRequest) (*WarpGenerationResponse, error)
GetSystemProxyStatus(context.Context, *Empty) (*SystemProxyStatus, error)
SetSystemProxyEnabled(context.Context, *SetSystemProxyEnabledRequest) (*Response, error)
- LogListener(Hiddify_LogListenerServer) error
- mustEmbedUnimplementedHiddifyServer()
+ LogListener(Core_LogListenerServer) error
+ mustEmbedUnimplementedCoreServer()
}
-// UnimplementedHiddifyServer must be embedded to have forward compatible implementations.
-type UnimplementedHiddifyServer struct {
+// UnimplementedCoreServer must be embedded to have forward compatible implementations.
+type UnimplementedCoreServer struct {
}
-func (UnimplementedHiddifyServer) SayHello(context.Context, *HelloRequest) (*HelloResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented")
-}
-func (UnimplementedHiddifyServer) SayHelloStream(Hiddify_SayHelloStreamServer) error {
- return status.Errorf(codes.Unimplemented, "method SayHelloStream not implemented")
-}
-func (UnimplementedHiddifyServer) Start(context.Context, *StartRequest) (*CoreInfoResponse, error) {
+func (UnimplementedCoreServer) Start(context.Context, *StartRequest) (*CoreInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Start not implemented")
}
-func (UnimplementedHiddifyServer) CoreInfoListener(Hiddify_CoreInfoListenerServer) error {
+func (UnimplementedCoreServer) CoreInfoListener(Core_CoreInfoListenerServer) error {
return status.Errorf(codes.Unimplemented, "method CoreInfoListener not implemented")
}
-func (UnimplementedHiddifyServer) OutboundsInfo(Hiddify_OutboundsInfoServer) error {
+func (UnimplementedCoreServer) OutboundsInfo(Core_OutboundsInfoServer) error {
return status.Errorf(codes.Unimplemented, "method OutboundsInfo not implemented")
}
-func (UnimplementedHiddifyServer) MainOutboundsInfo(Hiddify_MainOutboundsInfoServer) error {
+func (UnimplementedCoreServer) MainOutboundsInfo(Core_MainOutboundsInfoServer) error {
return status.Errorf(codes.Unimplemented, "method MainOutboundsInfo not implemented")
}
-func (UnimplementedHiddifyServer) GetSystemInfo(Hiddify_GetSystemInfoServer) error {
+func (UnimplementedCoreServer) GetSystemInfo(Core_GetSystemInfoServer) error {
return status.Errorf(codes.Unimplemented, "method GetSystemInfo not implemented")
}
-func (UnimplementedHiddifyServer) Setup(context.Context, *SetupRequest) (*Response, error) {
+func (UnimplementedCoreServer) Setup(context.Context, *SetupRequest) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method Setup not implemented")
}
-func (UnimplementedHiddifyServer) Parse(context.Context, *ParseRequest) (*ParseResponse, error) {
+func (UnimplementedCoreServer) Parse(context.Context, *ParseRequest) (*ParseResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Parse not implemented")
}
-func (UnimplementedHiddifyServer) StartService(context.Context, *StartRequest) (*CoreInfoResponse, error) {
+func (UnimplementedCoreServer) ChangeConfigOptions(context.Context, *ChangeConfigOptionsRequest) (*CoreInfoResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ChangeConfigOptions not implemented")
+}
+func (UnimplementedCoreServer) StartService(context.Context, *StartRequest) (*CoreInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method StartService not implemented")
}
-func (UnimplementedHiddifyServer) Stop(context.Context, *Empty) (*CoreInfoResponse, error) {
+func (UnimplementedCoreServer) Stop(context.Context, *Empty) (*CoreInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented")
}
-func (UnimplementedHiddifyServer) Restart(context.Context, *StartRequest) (*CoreInfoResponse, error) {
+func (UnimplementedCoreServer) Restart(context.Context, *StartRequest) (*CoreInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Restart not implemented")
}
-func (UnimplementedHiddifyServer) SelectOutbound(context.Context, *SelectOutboundRequest) (*Response, error) {
+func (UnimplementedCoreServer) SelectOutbound(context.Context, *SelectOutboundRequest) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method SelectOutbound not implemented")
}
-func (UnimplementedHiddifyServer) UrlTest(context.Context, *UrlTestRequest) (*Response, error) {
+func (UnimplementedCoreServer) UrlTest(context.Context, *UrlTestRequest) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method UrlTest not implemented")
}
-func (UnimplementedHiddifyServer) GenerateWarpConfig(context.Context, *GenerateWarpConfigRequest) (*WarpGenerationResponse, error) {
+func (UnimplementedCoreServer) GenerateWarpConfig(context.Context, *GenerateWarpConfigRequest) (*WarpGenerationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GenerateWarpConfig not implemented")
}
-func (UnimplementedHiddifyServer) GetSystemProxyStatus(context.Context, *Empty) (*SystemProxyStatus, error) {
+func (UnimplementedCoreServer) GetSystemProxyStatus(context.Context, *Empty) (*SystemProxyStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSystemProxyStatus not implemented")
}
-func (UnimplementedHiddifyServer) SetSystemProxyEnabled(context.Context, *SetSystemProxyEnabledRequest) (*Response, error) {
+func (UnimplementedCoreServer) SetSystemProxyEnabled(context.Context, *SetSystemProxyEnabledRequest) (*Response, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetSystemProxyEnabled not implemented")
}
-func (UnimplementedHiddifyServer) LogListener(Hiddify_LogListenerServer) error {
+func (UnimplementedCoreServer) LogListener(Core_LogListenerServer) error {
return status.Errorf(codes.Unimplemented, "method LogListener not implemented")
}
-func (UnimplementedHiddifyServer) mustEmbedUnimplementedHiddifyServer() {}
+func (UnimplementedCoreServer) mustEmbedUnimplementedCoreServer() {}
-// UnsafeHiddifyServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to HiddifyServer will
+// UnsafeCoreServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to CoreServer will
// result in compilation errors.
-type UnsafeHiddifyServer interface {
- mustEmbedUnimplementedHiddifyServer()
+type UnsafeCoreServer interface {
+ mustEmbedUnimplementedCoreServer()
}
-func RegisterHiddifyServer(s grpc.ServiceRegistrar, srv HiddifyServer) {
- s.RegisterService(&Hiddify_ServiceDesc, srv)
+func RegisterCoreServer(s grpc.ServiceRegistrar, srv CoreServer) {
+ s.RegisterService(&Core_ServiceDesc, srv)
}
-func _Hiddify_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(HelloRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(HiddifyServer).SayHello(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: Hiddify_SayHello_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).SayHello(ctx, req.(*HelloRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Hiddify_SayHelloStream_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HiddifyServer).SayHelloStream(&hiddifySayHelloStreamServer{stream})
-}
-
-type Hiddify_SayHelloStreamServer interface {
- Send(*HelloResponse) error
- Recv() (*HelloRequest, error)
- grpc.ServerStream
-}
-
-type hiddifySayHelloStreamServer struct {
- grpc.ServerStream
-}
-
-func (x *hiddifySayHelloStreamServer) Send(m *HelloResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-func (x *hiddifySayHelloStreamServer) Recv() (*HelloRequest, error) {
- m := new(HelloRequest)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-func _Hiddify_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).Start(ctx, in)
+ return srv.(CoreServer).Start(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_Start_FullMethodName,
+ FullMethod: Core_Start_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).Start(ctx, req.(*StartRequest))
+ return srv.(CoreServer).Start(ctx, req.(*StartRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_CoreInfoListener_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HiddifyServer).CoreInfoListener(&hiddifyCoreInfoListenerServer{stream})
+func _Core_CoreInfoListener_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(CoreServer).CoreInfoListener(&coreCoreInfoListenerServer{stream})
}
-type Hiddify_CoreInfoListenerServer interface {
+type Core_CoreInfoListenerServer interface {
Send(*CoreInfoResponse) error
Recv() (*StopRequest, error)
grpc.ServerStream
}
-type hiddifyCoreInfoListenerServer struct {
+type coreCoreInfoListenerServer struct {
grpc.ServerStream
}
-func (x *hiddifyCoreInfoListenerServer) Send(m *CoreInfoResponse) error {
+func (x *coreCoreInfoListenerServer) Send(m *CoreInfoResponse) error {
return x.ServerStream.SendMsg(m)
}
-func (x *hiddifyCoreInfoListenerServer) Recv() (*StopRequest, error) {
+func (x *coreCoreInfoListenerServer) Recv() (*StopRequest, error) {
m := new(StopRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
@@ -553,25 +630,25 @@ func (x *hiddifyCoreInfoListenerServer) Recv() (*StopRequest, error) {
return m, nil
}
-func _Hiddify_OutboundsInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HiddifyServer).OutboundsInfo(&hiddifyOutboundsInfoServer{stream})
+func _Core_OutboundsInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(CoreServer).OutboundsInfo(&coreOutboundsInfoServer{stream})
}
-type Hiddify_OutboundsInfoServer interface {
+type Core_OutboundsInfoServer interface {
Send(*OutboundGroupList) error
Recv() (*StopRequest, error)
grpc.ServerStream
}
-type hiddifyOutboundsInfoServer struct {
+type coreOutboundsInfoServer struct {
grpc.ServerStream
}
-func (x *hiddifyOutboundsInfoServer) Send(m *OutboundGroupList) error {
+func (x *coreOutboundsInfoServer) Send(m *OutboundGroupList) error {
return x.ServerStream.SendMsg(m)
}
-func (x *hiddifyOutboundsInfoServer) Recv() (*StopRequest, error) {
+func (x *coreOutboundsInfoServer) Recv() (*StopRequest, error) {
m := new(StopRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
@@ -579,25 +656,25 @@ func (x *hiddifyOutboundsInfoServer) Recv() (*StopRequest, error) {
return m, nil
}
-func _Hiddify_MainOutboundsInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HiddifyServer).MainOutboundsInfo(&hiddifyMainOutboundsInfoServer{stream})
+func _Core_MainOutboundsInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(CoreServer).MainOutboundsInfo(&coreMainOutboundsInfoServer{stream})
}
-type Hiddify_MainOutboundsInfoServer interface {
+type Core_MainOutboundsInfoServer interface {
Send(*OutboundGroupList) error
Recv() (*StopRequest, error)
grpc.ServerStream
}
-type hiddifyMainOutboundsInfoServer struct {
+type coreMainOutboundsInfoServer struct {
grpc.ServerStream
}
-func (x *hiddifyMainOutboundsInfoServer) Send(m *OutboundGroupList) error {
+func (x *coreMainOutboundsInfoServer) Send(m *OutboundGroupList) error {
return x.ServerStream.SendMsg(m)
}
-func (x *hiddifyMainOutboundsInfoServer) Recv() (*StopRequest, error) {
+func (x *coreMainOutboundsInfoServer) Recv() (*StopRequest, error) {
m := new(StopRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
@@ -605,25 +682,25 @@ func (x *hiddifyMainOutboundsInfoServer) Recv() (*StopRequest, error) {
return m, nil
}
-func _Hiddify_GetSystemInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HiddifyServer).GetSystemInfo(&hiddifyGetSystemInfoServer{stream})
+func _Core_GetSystemInfo_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(CoreServer).GetSystemInfo(&coreGetSystemInfoServer{stream})
}
-type Hiddify_GetSystemInfoServer interface {
+type Core_GetSystemInfoServer interface {
Send(*SystemInfo) error
Recv() (*StopRequest, error)
grpc.ServerStream
}
-type hiddifyGetSystemInfoServer struct {
+type coreGetSystemInfoServer struct {
grpc.ServerStream
}
-func (x *hiddifyGetSystemInfoServer) Send(m *SystemInfo) error {
+func (x *coreGetSystemInfoServer) Send(m *SystemInfo) error {
return x.ServerStream.SendMsg(m)
}
-func (x *hiddifyGetSystemInfoServer) Recv() (*StopRequest, error) {
+func (x *coreGetSystemInfoServer) Recv() (*StopRequest, error) {
m := new(StopRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
@@ -631,205 +708,223 @@ func (x *hiddifyGetSystemInfoServer) Recv() (*StopRequest, error) {
return m, nil
}
-func _Hiddify_Setup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_Setup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetupRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).Setup(ctx, in)
+ return srv.(CoreServer).Setup(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_Setup_FullMethodName,
+ FullMethod: Core_Setup_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).Setup(ctx, req.(*SetupRequest))
+ return srv.(CoreServer).Setup(ctx, req.(*SetupRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_Parse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_Parse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ParseRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).Parse(ctx, in)
+ return srv.(CoreServer).Parse(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_Parse_FullMethodName,
+ FullMethod: Core_Parse_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).Parse(ctx, req.(*ParseRequest))
+ return srv.(CoreServer).Parse(ctx, req.(*ParseRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_StartService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_ChangeConfigOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ChangeConfigOptionsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(CoreServer).ChangeConfigOptions(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Core_ChangeConfigOptions_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(CoreServer).ChangeConfigOptions(ctx, req.(*ChangeConfigOptionsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Core_StartService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).StartService(ctx, in)
+ return srv.(CoreServer).StartService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_StartService_FullMethodName,
+ FullMethod: Core_StartService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).StartService(ctx, req.(*StartRequest))
+ return srv.(CoreServer).StartService(ctx, req.(*StartRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).Stop(ctx, in)
+ return srv.(CoreServer).Stop(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_Stop_FullMethodName,
+ FullMethod: Core_Stop_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).Stop(ctx, req.(*Empty))
+ return srv.(CoreServer).Stop(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_Restart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_Restart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).Restart(ctx, in)
+ return srv.(CoreServer).Restart(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_Restart_FullMethodName,
+ FullMethod: Core_Restart_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).Restart(ctx, req.(*StartRequest))
+ return srv.(CoreServer).Restart(ctx, req.(*StartRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_SelectOutbound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_SelectOutbound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SelectOutboundRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).SelectOutbound(ctx, in)
+ return srv.(CoreServer).SelectOutbound(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_SelectOutbound_FullMethodName,
+ FullMethod: Core_SelectOutbound_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).SelectOutbound(ctx, req.(*SelectOutboundRequest))
+ return srv.(CoreServer).SelectOutbound(ctx, req.(*SelectOutboundRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_UrlTest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_UrlTest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UrlTestRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).UrlTest(ctx, in)
+ return srv.(CoreServer).UrlTest(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_UrlTest_FullMethodName,
+ FullMethod: Core_UrlTest_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).UrlTest(ctx, req.(*UrlTestRequest))
+ return srv.(CoreServer).UrlTest(ctx, req.(*UrlTestRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_GenerateWarpConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_GenerateWarpConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenerateWarpConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).GenerateWarpConfig(ctx, in)
+ return srv.(CoreServer).GenerateWarpConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_GenerateWarpConfig_FullMethodName,
+ FullMethod: Core_GenerateWarpConfig_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).GenerateWarpConfig(ctx, req.(*GenerateWarpConfigRequest))
+ return srv.(CoreServer).GenerateWarpConfig(ctx, req.(*GenerateWarpConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_GetSystemProxyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_GetSystemProxyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).GetSystemProxyStatus(ctx, in)
+ return srv.(CoreServer).GetSystemProxyStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_GetSystemProxyStatus_FullMethodName,
+ FullMethod: Core_GetSystemProxyStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).GetSystemProxyStatus(ctx, req.(*Empty))
+ return srv.(CoreServer).GetSystemProxyStatus(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_SetSystemProxyEnabled_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _Core_SetSystemProxyEnabled_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetSystemProxyEnabledRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(HiddifyServer).SetSystemProxyEnabled(ctx, in)
+ return srv.(CoreServer).SetSystemProxyEnabled(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: Hiddify_SetSystemProxyEnabled_FullMethodName,
+ FullMethod: Core_SetSystemProxyEnabled_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(HiddifyServer).SetSystemProxyEnabled(ctx, req.(*SetSystemProxyEnabledRequest))
+ return srv.(CoreServer).SetSystemProxyEnabled(ctx, req.(*SetSystemProxyEnabledRequest))
}
return interceptor(ctx, in, info, handler)
}
-func _Hiddify_LogListener_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HiddifyServer).LogListener(&hiddifyLogListenerServer{stream})
+func _Core_LogListener_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(CoreServer).LogListener(&coreLogListenerServer{stream})
}
-type Hiddify_LogListenerServer interface {
+type Core_LogListenerServer interface {
Send(*LogMessage) error
Recv() (*StopRequest, error)
grpc.ServerStream
}
-type hiddifyLogListenerServer struct {
+type coreLogListenerServer struct {
grpc.ServerStream
}
-func (x *hiddifyLogListenerServer) Send(m *LogMessage) error {
+func (x *coreLogListenerServer) Send(m *LogMessage) error {
return x.ServerStream.SendMsg(m)
}
-func (x *hiddifyLogListenerServer) Recv() (*StopRequest, error) {
+func (x *coreLogListenerServer) Recv() (*StopRequest, error) {
m := new(StopRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
@@ -837,99 +932,294 @@ func (x *hiddifyLogListenerServer) Recv() (*StopRequest, error) {
return m, nil
}
-// Hiddify_ServiceDesc is the grpc.ServiceDesc for Hiddify service.
+// Core_ServiceDesc is the grpc.ServiceDesc for Core service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
-var Hiddify_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "hiddifyrpc.Hiddify",
- HandlerType: (*HiddifyServer)(nil),
+var Core_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "hiddifyrpc.Core",
+ HandlerType: (*CoreServer)(nil),
Methods: []grpc.MethodDesc{
- {
- MethodName: "SayHello",
- Handler: _Hiddify_SayHello_Handler,
- },
{
MethodName: "Start",
- Handler: _Hiddify_Start_Handler,
+ Handler: _Core_Start_Handler,
},
{
MethodName: "Setup",
- Handler: _Hiddify_Setup_Handler,
+ Handler: _Core_Setup_Handler,
},
{
MethodName: "Parse",
- Handler: _Hiddify_Parse_Handler,
+ Handler: _Core_Parse_Handler,
+ },
+ {
+ MethodName: "ChangeConfigOptions",
+ Handler: _Core_ChangeConfigOptions_Handler,
},
{
MethodName: "StartService",
- Handler: _Hiddify_StartService_Handler,
+ Handler: _Core_StartService_Handler,
},
{
MethodName: "Stop",
- Handler: _Hiddify_Stop_Handler,
+ Handler: _Core_Stop_Handler,
},
{
MethodName: "Restart",
- Handler: _Hiddify_Restart_Handler,
+ Handler: _Core_Restart_Handler,
},
{
MethodName: "SelectOutbound",
- Handler: _Hiddify_SelectOutbound_Handler,
+ Handler: _Core_SelectOutbound_Handler,
},
{
MethodName: "UrlTest",
- Handler: _Hiddify_UrlTest_Handler,
+ Handler: _Core_UrlTest_Handler,
},
{
MethodName: "GenerateWarpConfig",
- Handler: _Hiddify_GenerateWarpConfig_Handler,
+ Handler: _Core_GenerateWarpConfig_Handler,
},
{
MethodName: "GetSystemProxyStatus",
- Handler: _Hiddify_GetSystemProxyStatus_Handler,
+ Handler: _Core_GetSystemProxyStatus_Handler,
},
{
MethodName: "SetSystemProxyEnabled",
- Handler: _Hiddify_SetSystemProxyEnabled_Handler,
+ Handler: _Core_SetSystemProxyEnabled_Handler,
},
},
Streams: []grpc.StreamDesc{
- {
- StreamName: "SayHelloStream",
- Handler: _Hiddify_SayHelloStream_Handler,
- ServerStreams: true,
- ClientStreams: true,
- },
{
StreamName: "CoreInfoListener",
- Handler: _Hiddify_CoreInfoListener_Handler,
+ Handler: _Core_CoreInfoListener_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "OutboundsInfo",
- Handler: _Hiddify_OutboundsInfo_Handler,
+ Handler: _Core_OutboundsInfo_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "MainOutboundsInfo",
- Handler: _Hiddify_MainOutboundsInfo_Handler,
+ Handler: _Core_MainOutboundsInfo_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "GetSystemInfo",
- Handler: _Hiddify_GetSystemInfo_Handler,
+ Handler: _Core_GetSystemInfo_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "LogListener",
- Handler: _Hiddify_LogListener_Handler,
+ Handler: _Core_LogListener_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "hiddifyrpc/hiddify.proto",
}
+
+const (
+ TunnelService_Start_FullMethodName = "/hiddifyrpc.TunnelService/Start"
+ TunnelService_Stop_FullMethodName = "/hiddifyrpc.TunnelService/Stop"
+ TunnelService_Status_FullMethodName = "/hiddifyrpc.TunnelService/Status"
+ TunnelService_Exit_FullMethodName = "/hiddifyrpc.TunnelService/Exit"
+)
+
+// TunnelServiceClient is the client API for TunnelService service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type TunnelServiceClient interface {
+ Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*TunnelResponse, error)
+ Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TunnelResponse, error)
+ Status(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TunnelResponse, error)
+ Exit(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TunnelResponse, error)
+}
+
+type tunnelServiceClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewTunnelServiceClient(cc grpc.ClientConnInterface) TunnelServiceClient {
+ return &tunnelServiceClient{cc}
+}
+
+func (c *tunnelServiceClient) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*TunnelResponse, error) {
+ out := new(TunnelResponse)
+ err := c.cc.Invoke(ctx, TunnelService_Start_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *tunnelServiceClient) Stop(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TunnelResponse, error) {
+ out := new(TunnelResponse)
+ err := c.cc.Invoke(ctx, TunnelService_Stop_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *tunnelServiceClient) Status(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TunnelResponse, error) {
+ out := new(TunnelResponse)
+ err := c.cc.Invoke(ctx, TunnelService_Status_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *tunnelServiceClient) Exit(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TunnelResponse, error) {
+ out := new(TunnelResponse)
+ err := c.cc.Invoke(ctx, TunnelService_Exit_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// TunnelServiceServer is the server API for TunnelService service.
+// All implementations must embed UnimplementedTunnelServiceServer
+// for forward compatibility
+type TunnelServiceServer interface {
+ Start(context.Context, *StartRequest) (*TunnelResponse, error)
+ Stop(context.Context, *Empty) (*TunnelResponse, error)
+ Status(context.Context, *Empty) (*TunnelResponse, error)
+ Exit(context.Context, *Empty) (*TunnelResponse, error)
+ mustEmbedUnimplementedTunnelServiceServer()
+}
+
+// UnimplementedTunnelServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedTunnelServiceServer struct {
+}
+
+func (UnimplementedTunnelServiceServer) Start(context.Context, *StartRequest) (*TunnelResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Start not implemented")
+}
+func (UnimplementedTunnelServiceServer) Stop(context.Context, *Empty) (*TunnelResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented")
+}
+func (UnimplementedTunnelServiceServer) Status(context.Context, *Empty) (*TunnelResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Status not implemented")
+}
+func (UnimplementedTunnelServiceServer) Exit(context.Context, *Empty) (*TunnelResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Exit not implemented")
+}
+func (UnimplementedTunnelServiceServer) mustEmbedUnimplementedTunnelServiceServer() {}
+
+// UnsafeTunnelServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to TunnelServiceServer will
+// result in compilation errors.
+type UnsafeTunnelServiceServer interface {
+ mustEmbedUnimplementedTunnelServiceServer()
+}
+
+func RegisterTunnelServiceServer(s grpc.ServiceRegistrar, srv TunnelServiceServer) {
+ s.RegisterService(&TunnelService_ServiceDesc, srv)
+}
+
+func _TunnelService_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(StartRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(TunnelServiceServer).Start(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: TunnelService_Start_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(TunnelServiceServer).Start(ctx, req.(*StartRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _TunnelService_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(Empty)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(TunnelServiceServer).Stop(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: TunnelService_Stop_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(TunnelServiceServer).Stop(ctx, req.(*Empty))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _TunnelService_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(Empty)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(TunnelServiceServer).Status(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: TunnelService_Status_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(TunnelServiceServer).Status(ctx, req.(*Empty))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _TunnelService_Exit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(Empty)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(TunnelServiceServer).Exit(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: TunnelService_Exit_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(TunnelServiceServer).Exit(ctx, req.(*Empty))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// TunnelService_ServiceDesc is the grpc.ServiceDesc for TunnelService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var TunnelService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "hiddifyrpc.TunnelService",
+ HandlerType: (*TunnelServiceServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "Start",
+ Handler: _TunnelService_Start_Handler,
+ },
+ {
+ MethodName: "Stop",
+ Handler: _TunnelService_Stop_Handler,
+ },
+ {
+ MethodName: "Status",
+ Handler: _TunnelService_Status_Handler,
+ },
+ {
+ MethodName: "Exit",
+ Handler: _TunnelService_Exit_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "hiddifyrpc/hiddify.proto",
+}
diff --git a/v2/commands.go b/v2/commands.go
index 4341b4c..d7fe9fc 100644
--- a/v2/commands.go
+++ b/v2/commands.go
@@ -6,12 +6,11 @@ import (
pb "github.com/hiddify/libcore/hiddifyrpc"
"github.com/sagernet/sing-box/experimental/libbox"
- "github.com/sagernet/sing/common/observable"
)
-var systemInfoObserver = observable.Observer[pb.SystemInfo]{}
-var outboundsInfoObserver = observable.Observer[pb.OutboundGroupList]{}
-var mainOutboundsInfoObserver = observable.Observer[pb.OutboundGroupList]{}
+var systemInfoObserver = NewObserver[pb.SystemInfo](10)
+var outboundsInfoObserver = NewObserver[pb.OutboundGroupList](10)
+var mainOutboundsInfoObserver = NewObserver[pb.OutboundGroupList](10)
var (
statusClient *libbox.CommandClient
@@ -19,7 +18,7 @@ var (
groupInfoOnlyClient *libbox.CommandClient
)
-func (s *server) GetSystemInfo(stream pb.Hiddify_GetSystemInfoServer) error {
+func (s *CoreService) GetSystemInfo(stream pb.Core_GetSystemInfoServer) error {
if statusClient == nil {
statusClient = libbox.NewCommandClient(
&CommandClientHandler{},
@@ -55,7 +54,7 @@ func (s *server) GetSystemInfo(stream pb.Hiddify_GetSystemInfoServer) error {
}
}
-func (s *server) OutboundsInfo(stream pb.Hiddify_OutboundsInfoServer) error {
+func (s *CoreService) OutboundsInfo(stream pb.Core_OutboundsInfoServer) error {
if groupClient == nil {
groupClient = libbox.NewCommandClient(
&CommandClientHandler{},
@@ -91,7 +90,7 @@ func (s *server) OutboundsInfo(stream pb.Hiddify_OutboundsInfoServer) error {
}
}
-func (s *server) MainOutboundsInfo(stream pb.Hiddify_MainOutboundsInfoServer) error {
+func (s *CoreService) MainOutboundsInfo(stream pb.Core_MainOutboundsInfoServer) error {
if groupInfoOnlyClient == nil {
groupInfoOnlyClient = libbox.NewCommandClient(
&CommandClientHandler{},
@@ -127,8 +126,10 @@ func (s *server) MainOutboundsInfo(stream pb.Hiddify_MainOutboundsInfoServer) er
}
}
-// Implement the SelectOutbound method
-func (s *server) SelectOutbound(ctx context.Context, in *pb.SelectOutboundRequest) (*pb.Response, error) {
+func (s *CoreService) SelectOutbound(ctx context.Context, in *pb.SelectOutboundRequest) (*pb.Response, error) {
+ return SelectOutbound(in)
+}
+func SelectOutbound(in *pb.SelectOutboundRequest) (*pb.Response, error) {
err := libbox.NewStandaloneCommandClient().SelectOutbound(in.GroupTag, in.OutboundTag)
if err != nil {
@@ -144,8 +145,10 @@ func (s *server) SelectOutbound(ctx context.Context, in *pb.SelectOutboundReques
}, nil
}
-// Implement the UrlTest method
-func (s *server) UrlTest(ctx context.Context, in *pb.UrlTestRequest) (*pb.Response, error) {
+func (s *CoreService) UrlTest(ctx context.Context, in *pb.UrlTestRequest) (*pb.Response, error) {
+ return UrlTest(in)
+}
+func UrlTest(in *pb.UrlTestRequest) (*pb.Response, error) {
err := libbox.NewStandaloneCommandClient().URLTest(in.GroupTag)
if err != nil {
diff --git a/v2/coreinfo.go b/v2/coreinfo.go
index 696e286..7116d80 100644
--- a/v2/coreinfo.go
+++ b/v2/coreinfo.go
@@ -1,16 +1,18 @@
package v2
import (
+ "encoding/json"
"time"
+ "github.com/hiddify/libcore/bridge"
pb "github.com/hiddify/libcore/hiddifyrpc"
- "github.com/sagernet/sing/common/observable"
)
-var coreInfoObserver = observable.Observer[pb.CoreInfoResponse]{}
+var coreInfoObserver = NewObserver[pb.CoreInfoResponse](10)
var CoreState = pb.CoreState_STOPPED
func SetCoreStatus(state pb.CoreState, msgType pb.MessageType, message string) pb.CoreInfoResponse {
+ Log(pb.LogLevel_INFO, pb.LogType_CORE, message)
CoreState = state
info := pb.CoreInfoResponse{
CoreState: state,
@@ -18,11 +20,13 @@ func SetCoreStatus(state pb.CoreState, msgType pb.MessageType, message string) p
Message: message,
}
coreInfoObserver.Emit(info)
+ msg, _ := json.Marshal(StatusMessage{Status: convert2OldState(CoreState)})
+ bridge.SendStringToPort(statusPropagationPort, string(msg))
return info
}
-func (s *server) CoreInfoListener(stream pb.Hiddify_CoreInfoListenerServer) error {
+func (s *CoreService) CoreInfoListener(stream pb.Core_CoreInfoListenerServer) error {
coreSub, _, _ := coreInfoObserver.Subscribe()
defer coreInfoObserver.UnSubscribe(coreSub)
stopch := make(chan int)
diff --git a/v2/custom.go b/v2/custom.go
index 57cdf2e..60fe507 100644
--- a/v2/custom.go
+++ b/v2/custom.go
@@ -2,11 +2,13 @@ package v2
import (
"context"
+ "encoding/json"
"fmt"
"os"
"path/filepath"
"time"
+ "github.com/hiddify/libcore/bridge"
"github.com/hiddify/libcore/config"
pb "github.com/hiddify/libcore/hiddifyrpc"
"github.com/sagernet/sing-box/experimental/libbox"
@@ -22,19 +24,26 @@ var logFactory *log.Factory
func StopAndAlert(msgType pb.MessageType, message string) {
SetCoreStatus(pb.CoreState_STOPPED, msgType, message)
config.DeactivateTunnelService()
- // if commandServer != nil {
- // commandServer.SetService(nil)
- // }
+ if commandServer != nil {
+ commandServer.SetService(nil)
+ }
if Box != nil {
Box.Close()
Box = nil
}
- // if commandServer != nil {
- // commandServer.Close()
- // }
+ if commandServer != nil {
+ commandServer.Close()
+ }
+ alert := msgType.String()
+ msg, _ := json.Marshal(StatusMessage{Status: convert2OldState(CoreState), Alert: &alert, Message: &message})
+ bridge.SendStringToPort(statusPropagationPort, string(msg))
}
-func (s *server) Start(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
+func (s *CoreService) Start(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
+ return Start(in)
+}
+
+func Start(in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
defer config.DeferPanicToError("start", func(err error) {
Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error())
@@ -49,17 +58,23 @@ func (s *server) Start(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoRe
SetCoreStatus(pb.CoreState_STARTING, pb.MessageType_EMPTY, "")
libbox.SetMemoryLimit(!in.DisableMemoryLimit)
- resp, err := s.StartService(ctx, in)
+ resp, err := StartService(in)
return resp, err
}
-
-// Implement the StartService method
-func (s *server) StartService(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
+func (s *CoreService) StartService(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
+ return StartService(in)
+}
+func StartService(in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
content := in.ConfigContent
- if content != "" {
+ if content == "" {
+
+ if in.ConfigPath != "" {
+ activeConfigPath = &in.ConfigPath
+ }
fileContent, err := os.ReadFile(*activeConfigPath)
if err != nil {
+ Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_ERROR_READING_CONFIG, err.Error())
return &resp, err
}
@@ -68,26 +83,31 @@ func (s *server) StartService(ctx context.Context, in *pb.StartRequest) (*pb.Cor
parsedContent, err := parseConfig(content)
if err != nil {
+ Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_ERROR_PARSING_CONFIG, err.Error())
return &resp, err
}
var patchedOptions *option.Options
patchedOptions, err = config.BuildConfig(*configOptions, parsedContent)
if err != nil {
+ Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_ERROR_BUILDING_CONFIG, err.Error())
return &resp, err
}
config.SaveCurrentConfig(filepath.Join(sWorkingPath, "current-config.json"), *patchedOptions)
-
- // err = startCommandServer(*logFactory)
- // if err != nil {
- // resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_START_COMMAND_SERVER, err.Error())
- // return &resp, err
- // }
+ if in.EnableOldCommandServer {
+ err = startCommandServer(*logFactory)
+ if err != nil {
+ Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
+ resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_START_COMMAND_SERVER, err.Error())
+ return &resp, err
+ }
+ }
instance, err := NewService(*patchedOptions)
if err != nil {
+ Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_CREATE_SERVICE, err.Error())
return &resp, err
}
@@ -98,30 +118,55 @@ func (s *server) StartService(ctx context.Context, in *pb.StartRequest) (*pb.Cor
err = instance.Start()
if err != nil {
+ Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_START_SERVICE, err.Error())
return &resp, err
}
Box = instance
- // commandServer.SetService(box)
+ if in.EnableOldCommandServer {
+ commandServer.SetService(Box)
+ }
resp := SetCoreStatus(pb.CoreState_STARTED, pb.MessageType_EMPTY, "")
return &resp, nil
}
-func (s *server) Parse(ctx context.Context, in *pb.ParseRequest) (*pb.ParseResponse, error) {
+func (s *CoreService) Parse(ctx context.Context, in *pb.ParseRequest) (*pb.ParseResponse, error) {
+ return Parse(in)
+}
+func Parse(in *pb.ParseRequest) (*pb.ParseResponse, error) {
defer config.DeferPanicToError("parse", func(err error) {
Log(pb.LogLevel_FATAL, pb.LogType_CONFIG, err.Error())
StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error())
})
+ content := in.Content
+ if in.TempPath != "" {
+ contentBytes, err := os.ReadFile(in.TempPath)
+ content = string(contentBytes)
+ os.Chdir(filepath.Dir(in.ConfigPath))
+ if err != nil {
+ return nil, err
+ }
- config, err := config.ParseConfigContent(in.Content, true)
+ }
+
+ config, err := config.ParseConfigContent(content, true)
if err != nil {
return &pb.ParseResponse{
ResponseCode: pb.ResponseCode_FAILED,
Message: err.Error(),
}, err
}
+ if in.ConfigPath != "" {
+ err = os.WriteFile(in.ConfigPath, config, 0644)
+ if err != nil {
+ return &pb.ParseResponse{
+ ResponseCode: pb.ResponseCode_FAILED,
+ Message: err.Error(),
+ }, err
+ }
+ }
return &pb.ParseResponse{
ResponseCode: pb.ResponseCode_OK,
Content: string(config),
@@ -129,31 +174,67 @@ func (s *server) Parse(ctx context.Context, in *pb.ParseRequest) (*pb.ParseRespo
}, err
}
-// func (s *server) ChangeConfigOptions(ctx context.Context, in *pb.ChangeConfigOptionsRequest) (*pb.CoreInfoResponse, error) {
-// // Implement your change config options logic
-// // Return a CoreInfoResponse
-// }
+func (s *CoreService) ChangeConfigOptions(ctx context.Context, in *pb.ChangeConfigOptionsRequest) (*pb.CoreInfoResponse, error) {
+ return ChangeConfigOptions(in)
+}
-// func (s *server) GenerateConfig(ctx context.Context, in *pb.GenerateConfigRequest) (*pb.GenerateConfigResponse, error) {
-// defer config.DeferPanicToError("generateConfig", func(err error) {
-// Log(pb.LogLevel_FATAL, pb.LogType_CONFIG, err.Error())
-// StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error())
-// })
+func ChangeConfigOptions(in *pb.ChangeConfigOptionsRequest) (*pb.CoreInfoResponse, error) {
+ configOptions = &config.ConfigOptions{}
+ err := json.Unmarshal([]byte(in.ConfigOptionsJson), configOptions)
+ if err != nil {
+ return nil, err
+ }
+ if configOptions.Warp.WireguardConfigStr != "" {
+ err := json.Unmarshal([]byte(configOptions.Warp.WireguardConfigStr), &configOptions.Warp.WireguardConfig)
+ if err != nil {
+ return nil, err
+ }
+ }
+ return &pb.CoreInfoResponse{}, nil
+}
+func (s *CoreService) GenerateConfig(ctx context.Context, in *pb.GenerateConfigRequest) (*pb.GenerateConfigResponse, error) {
+ return GenerateConfig(in)
+}
+func GenerateConfig(in *pb.GenerateConfigRequest) (*pb.GenerateConfigResponse, error) {
+ defer config.DeferPanicToError("generateConfig", func(err error) {
+ Log(pb.LogLevel_FATAL, pb.LogType_CONFIG, err.Error())
+ StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error())
+ })
-// config, err := generateConfigFromFile(C.GoString(path), *configOptions)
-// if err != nil {
-// return C.CString("error" + err.Error())
-// }
-// return C.CString(config)
-// }
+ config, err := generateConfigFromFile(in.Path, *configOptions)
+ if err != nil {
+ return nil, err
+ }
+ return &pb.GenerateConfigResponse{
+ ConfigContent: config,
+ }, nil
+}
+func generateConfigFromFile(path string, configOpt config.ConfigOptions) (string, error) {
+ os.Chdir(filepath.Dir(path))
+ content, err := os.ReadFile(path)
+ if err != nil {
+ return "", err
+ }
+ options, err := parseConfig(string(content))
+ if err != nil {
+ return "", err
+ }
+ config, err := config.BuildConfigJson(configOpt, options)
+ if err != nil {
+ return "", err
+ }
+ return config, nil
+}
-// Implement the Stop method
-func (s *server) Stop(ctx context.Context, empty *pb.Empty) (*pb.CoreInfoResponse, error) {
+func (s *CoreService) Stop(ctx context.Context, empty *pb.Empty) (*pb.CoreInfoResponse, error) {
+ return Stop()
+}
+func Stop() (*pb.CoreInfoResponse, error) {
defer config.DeferPanicToError("stop", func(err error) {
Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error())
})
- config.DeactivateTunnelService()
+
if CoreState != pb.CoreState_STARTED {
Log(pb.LogLevel_FATAL, pb.LogType_CORE, "Core is not started")
return &pb.CoreInfoResponse{
@@ -170,7 +251,10 @@ func (s *server) Stop(ctx context.Context, empty *pb.Empty) (*pb.CoreInfoRespons
}, fmt.Errorf("instance not found")
}
SetCoreStatus(pb.CoreState_STOPPING, pb.MessageType_EMPTY, "")
- // commandServer.SetService(nil)
+ config.DeactivateTunnelService()
+ if commandServer != nil {
+ commandServer.SetService(nil)
+ }
err := Box.Close()
if err != nil {
@@ -181,22 +265,25 @@ func (s *server) Stop(ctx context.Context, empty *pb.Empty) (*pb.CoreInfoRespons
}, fmt.Errorf("Error while stopping the service.")
}
Box = nil
- // err = commandServer.Close()
- // if err != nil {
- // return &pb.CoreInfoResponse{
- // CoreState: CoreState,
- // MessageType: pb.MessageType_UNEXPECTED_ERROR,
- // Message: "Error while Closing the comand server.",
- // }, fmt.Errorf("Error while Closing the comand server.")
-
- // }
- // commandServer = nil
+ if commandServer != nil {
+ err = commandServer.Close()
+ if err != nil {
+ return &pb.CoreInfoResponse{
+ CoreState: CoreState,
+ MessageType: pb.MessageType_UNEXPECTED_ERROR,
+ Message: "Error while Closing the comand server.",
+ }, fmt.Errorf("Error while Closing the comand server.")
+ }
+ commandServer = nil
+ }
resp := SetCoreStatus(pb.CoreState_STOPPED, pb.MessageType_EMPTY, "")
return &resp, nil
}
-
-func (s *server) Restart(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
+func (s *CoreService) Restart(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
+ return Restart(in)
+}
+func Restart(in *pb.StartRequest) (*pb.CoreInfoResponse, error) {
defer config.DeferPanicToError("restart", func(err error) {
Log(pb.LogLevel_FATAL, pb.LogType_CORE, err.Error())
StopAndAlert(pb.MessageType_UNEXPECTED_ERROR, err.Error())
@@ -218,7 +305,7 @@ func (s *server) Restart(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfo
}, fmt.Errorf("instance not found")
}
- resp, err := s.Stop(ctx, &pb.Empty{})
+ resp, err := Stop()
if err != nil {
return resp, err
}
@@ -227,6 +314,6 @@ func (s *server) Restart(ctx context.Context, in *pb.StartRequest) (*pb.CoreInfo
<-time.After(250 * time.Millisecond)
libbox.SetMemoryLimit(!in.DisableMemoryLimit)
- resp, gErr := s.StartService(ctx, in)
+ resp, gErr := StartService(in)
return resp, gErr
}
diff --git a/v2/example_client/main.go b/v2/example_client/main.go
index 88ecb7a..3ff98d5 100644
--- a/v2/example_client/main.go
+++ b/v2/example_client/main.go
@@ -21,7 +21,7 @@ func main() {
log.Fatalf("did not connect: %v", err)
}
defer conn.Close()
- c := pb.NewHiddifyClient(conn)
+ c := pb.NewHelloClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
diff --git a/v2/example_server/main.go b/v2/example_server/main.go
index 5bb0a15..9b4e535 100644
--- a/v2/example_server/main.go
+++ b/v2/example_server/main.go
@@ -11,7 +11,7 @@ import (
func main() {
// defer C.free(unsafe.Pointer(port))
- v2.StartGrpcServerGo("127.0.0.1:50051")
+ v2.StartGrpcServer("127.0.0.1:50051")
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
<-sigChan
diff --git a/v2/grpc_server.go b/v2/grpc_server.go
index a0f6f2e..b66c60a 100644
--- a/v2/grpc_server.go
+++ b/v2/grpc_server.go
@@ -13,24 +13,18 @@ import (
"google.golang.org/grpc"
)
-type server struct {
- pb.UnimplementedHiddifyServer
+type HelloService struct {
+ pb.UnimplementedHelloServer
+}
+type CoreService struct {
+ pb.UnimplementedCoreServer
}
-//export StartGrpcServer
-func StartGrpcServer(listenAddress *C.char) (CErr *C.char) {
- //Example Listen Address: "127.0.0.1:50051"
- err := StartGrpcServerGo(C.GoString(listenAddress))
- if err != nil {
- return C.CString(err.Error())
- }
- return nil
+type TunnelService struct {
+ pb.UnimplementedTunnelServiceServer
}
-func StartGrpcServerGo(listenAddressG string) error {
- //Example Listen Address: "127.0.0.1:50051"
- // defer C.free(unsafe.Pointer(CErr)) // free the C string when it's no longer needed
- // defer C.free(unsafe.Pointer(listenAddress)) // free the C string when it's no longer needed
+func StartGrpcServer(listenAddressG string, service string) error {
lis, err := net.Listen("tcp", listenAddressG)
if err != nil {
@@ -38,7 +32,13 @@ func StartGrpcServerGo(listenAddressG string) error {
return err
}
s := grpc.NewServer()
- pb.RegisterHiddifyServer(s, &server{})
+ if service == "core" {
+ pb.RegisterCoreServer(s, &CoreService{})
+ } else if service == "hello" {
+ pb.RegisterHelloServer(s, &HelloService{})
+ } else if service == "tunnel" {
+ pb.RegisterTunnelServiceServer(s, &TunnelService{})
+ }
log.Printf("Server listening on %s", listenAddressG)
go func() {
if err := s.Serve(lis); err != nil {
@@ -47,3 +47,14 @@ func StartGrpcServerGo(listenAddressG string) error {
}()
return nil
}
+func StartCoreGrpcServer(listenAddressG string) error {
+ return StartGrpcServer(listenAddressG, "core")
+}
+
+func StartHelloGrpcServer(listenAddressG string) error {
+ return StartGrpcServer(listenAddressG, "hello")
+}
+
+func StartTunnelGrpcServer(listenAddressG string) error {
+ return StartGrpcServer(listenAddressG, "tunnel")
+}
diff --git a/v2/hello.go b/v2/hello.go
index e29965b..c8693a1 100644
--- a/v2/hello.go
+++ b/v2/hello.go
@@ -8,10 +8,10 @@ import (
pb "github.com/hiddify/libcore/hiddifyrpc"
)
-func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloResponse, error) {
+func (s *HelloService) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloResponse, error) {
return &pb.HelloResponse{Message: "Hello, " + in.Name}, nil
}
-func (s *server) SayHelloStream(stream pb.Hiddify_SayHelloStreamServer) error {
+func (s *HelloService) SayHelloStream(stream pb.Hello_SayHelloStreamServer) error {
for {
req, err := stream.Recv()
diff --git a/v2/logproto.go b/v2/logproto.go
index e418ae6..fbfe3ee 100644
--- a/v2/logproto.go
+++ b/v2/logproto.go
@@ -1,15 +1,21 @@
package v2
import (
+ "fmt"
"time"
pb "github.com/hiddify/libcore/hiddifyrpc"
"github.com/sagernet/sing/common/observable"
)
-var logObserver = observable.Observer[pb.LogMessage]{}
+func NewObserver[T any](listenerBufferSize int) *observable.Observer[T] {
+ return observable.NewObserver[T](&observable.Subscriber[T]{}, listenerBufferSize)
+}
+
+var logObserver = NewObserver[pb.LogMessage](10)
func Log(level pb.LogLevel, typ pb.LogType, message string) {
+ fmt.Printf("%s %s %s\n", level, typ, message)
logObserver.Emit(pb.LogMessage{
Level: level,
Type: typ,
@@ -18,7 +24,7 @@ func Log(level pb.LogLevel, typ pb.LogType, message string) {
}
-func (s *server) LogListener(stream pb.Hiddify_LogListenerServer) error {
+func (s *CoreService) LogListener(stream pb.Core_LogListenerServer) error {
logSub, _, _ := logObserver.Subscribe()
defer logObserver.UnSubscribe(logSub)
@@ -30,9 +36,7 @@ func (s *server) LogListener(stream pb.Hiddify_LogListenerServer) error {
for {
select {
case <-stream.Context().Done():
- break
- case <-stopch:
- break
+ return nil
case info := <-logSub:
stream.Send(&info)
case <-time.After(500 * time.Millisecond):
diff --git a/custom/command_client.go b/v2/old_command_client.go
similarity index 61%
rename from custom/command_client.go
rename to v2/old_command_client.go
index 9a78d23..1655c1c 100644
--- a/custom/command_client.go
+++ b/v2/old_command_client.go
@@ -1,4 +1,4 @@
-package main
+package v2
import (
"encoding/json"
@@ -6,31 +6,34 @@ import (
"github.com/hiddify/libcore/bridge"
"github.com/sagernet/sing-box/experimental/libbox"
- "github.com/sagernet/sing-box/log"
)
-type CommandClientHandler struct {
- port int64
- logger log.Logger
+var (
+ _ libbox.CommandClientHandler = (*OldCommandClientHandler)(nil)
+)
+
+type OldCommandClientHandler struct {
+ port int64
+ // logger log.Logger
}
-func (cch *CommandClientHandler) Connected() {
- cch.logger.Debug("CONNECTED")
+func (cch *OldCommandClientHandler) Connected() {
+ // cch.logger.Debug("CONNECTED")
}
-func (cch *CommandClientHandler) Disconnected(message string) {
- cch.logger.Debug("DISCONNECTED: ", message)
+func (cch *OldCommandClientHandler) Disconnected(message string) {
+ // cch.logger.Debug("DISCONNECTED: ", message)
}
-func (cch *CommandClientHandler) ClearLog() {
- cch.logger.Debug("clear log")
+func (cch *OldCommandClientHandler) ClearLog() {
+ // cch.logger.Debug("clear log")
}
-func (cch *CommandClientHandler) WriteLog(message string) {
- cch.logger.Debug("log: ", message)
+func (cch *OldCommandClientHandler) WriteLog(message string) {
+ // cch.logger.Debug("log: ", message)
}
-func (cch *CommandClientHandler) WriteStatus(message *libbox.StatusMessage) {
+func (cch *OldCommandClientHandler) WriteStatus(message *libbox.StatusMessage) {
msg, err := json.Marshal(
map[string]int64{
"connections-in": int64(message.ConnectionsIn),
@@ -41,7 +44,7 @@ func (cch *CommandClientHandler) WriteStatus(message *libbox.StatusMessage) {
"downlink-total": message.DownlinkTotal,
},
)
- cch.logger.Debug("Memory: ", libbox.FormatBytes(message.Memory), ", Goroutines: ", message.Goroutines)
+ // cch.logger.Debug("Memory: ", libbox.FormatBytes(message.Memory), ", Goroutines: ", message.Goroutines)
if err != nil {
bridge.SendStringToPort(cch.port, fmt.Sprintf("error: %e", err))
} else {
@@ -49,7 +52,7 @@ func (cch *CommandClientHandler) WriteStatus(message *libbox.StatusMessage) {
}
}
-func (cch *CommandClientHandler) WriteGroups(message libbox.OutboundGroupIterator) {
+func (cch *OldCommandClientHandler) WriteGroups(message libbox.OutboundGroupIterator) {
if message == nil {
return
}
@@ -79,12 +82,12 @@ func (cch *CommandClientHandler) WriteGroups(message libbox.OutboundGroupIterato
}
}
-func (cch *CommandClientHandler) InitializeClashMode(modeList libbox.StringIterator, currentMode string) {
- cch.logger.Debug("initial clash mode: ", currentMode)
+func (cch *OldCommandClientHandler) InitializeClashMode(modeList libbox.StringIterator, currentMode string) {
+ // cch.logger.Debug("initial clash mode: ", currentMode)
}
-func (cch *CommandClientHandler) UpdateClashMode(newMode string) {
- cch.logger.Debug("update clash mode: ", newMode)
+func (cch *OldCommandClientHandler) UpdateClashMode(newMode string) {
+ // cch.logger.Debug("update clash mode: ", newMode)
}
type OutboundGroup struct {
diff --git a/custom/command_server.go b/v2/old_command_server.go
similarity index 81%
rename from custom/command_server.go
rename to v2/old_command_server.go
index 17483b2..b4c5eeb 100644
--- a/custom/command_server.go
+++ b/v2/old_command_server.go
@@ -1,11 +1,10 @@
-package main
+package v2
import (
pb "github.com/hiddify/libcore/hiddifyrpc"
- v2 "github.com/hiddify/libcore/v2"
+
"github.com/sagernet/sing-box/experimental/libbox"
"github.com/sagernet/sing-box/log"
-
)
var commandServer *libbox.CommandServer
@@ -16,16 +15,21 @@ type CommandServerHandler struct {
func (csh *CommandServerHandler) ServiceReload() error {
csh.logger.Trace("Reloading service")
- propagateStatus(pb.CoreState_STARTING)
+ SetCoreStatus(pb.CoreState_STARTING, pb.MessageType_EMPTY, "")
+
if commandServer != nil {
commandServer.SetService(nil)
commandServer = nil
}
- if v2.Box != nil {
- v2.Box.Close()
- v2.Box = nil
+ if Box != nil {
+ Box.Close()
+ Box = nil
}
- return startService(true)
+ _, err := StartService(&pb.StartRequest{
+ EnableOldCommandServer: true,
+ DelayStart: true,
+ })
+ return err
}
func (csh *CommandServerHandler) GetSystemProxyStatus() *libbox.SystemProxyStatus {
diff --git a/v2/old_commands.go b/v2/old_commands.go
new file mode 100644
index 0000000..1a2655f
--- /dev/null
+++ b/v2/old_commands.go
@@ -0,0 +1,71 @@
+package v2
+
+import (
+ "github.com/sagernet/sing-box/experimental/libbox"
+)
+
+var (
+ oldStatusClient *libbox.CommandClient
+ oldGroupClient *libbox.CommandClient
+ oldGroupInfoOnlyClient *libbox.CommandClient
+)
+
+func StartCommand(command int32, port int64) error {
+ switch command {
+ case libbox.CommandStatus:
+ oldStatusClient = libbox.NewCommandClient(
+ &OldCommandClientHandler{
+ port: port,
+ // logger: logFactory.NewLogger("[Status Command Client]"),
+ },
+ &libbox.CommandClientOptions{
+ Command: libbox.CommandStatus,
+ StatusInterval: 1000000000, //1000ms debounce
+ },
+ )
+ return oldStatusClient.Connect()
+ case libbox.CommandGroup:
+ oldGroupClient = libbox.NewCommandClient(
+ &OldCommandClientHandler{
+ port: port,
+ // logger: logFactory.NewLogger("[Group Command Client]"),
+ },
+ &libbox.CommandClientOptions{
+ Command: libbox.CommandGroup,
+ StatusInterval: 300000000, //300ms debounce
+ },
+ )
+ return oldGroupClient.Connect()
+ case libbox.CommandGroupInfoOnly:
+ oldGroupInfoOnlyClient = libbox.NewCommandClient(
+ &OldCommandClientHandler{
+ port: port,
+ // logger: logFactory.NewLogger("[GroupInfoOnly Command Client]"),
+ },
+ &libbox.CommandClientOptions{
+ Command: libbox.CommandGroupInfoOnly,
+ StatusInterval: 300000000, //300ms debounce
+ },
+ )
+ return oldGroupInfoOnlyClient.Connect()
+ }
+ return nil
+}
+
+func StopCommand(command int32) error {
+ switch command {
+ case libbox.CommandStatus:
+ err := oldStatusClient.Disconnect()
+ oldStatusClient = nil
+ return err
+ case libbox.CommandGroup:
+ err := oldGroupClient.Disconnect()
+ oldGroupClient = nil
+ return err
+ case libbox.CommandGroupInfoOnly:
+ err := oldGroupInfoOnlyClient.Disconnect()
+ oldGroupInfoOnlyClient = nil
+ return err
+ }
+ return nil
+}
diff --git a/v2/old_constant.go b/v2/old_constant.go
new file mode 100644
index 0000000..d1c5505
--- /dev/null
+++ b/v2/old_constant.go
@@ -0,0 +1,38 @@
+package v2
+
+import pb "github.com/hiddify/libcore/hiddifyrpc"
+
+const (
+ Stopped = "Stopped"
+ Starting = "Starting"
+ Started = "Started"
+ Stopping = "Stopping"
+)
+
+const (
+ EmptyConfiguration = "EmptyConfiguration"
+ StartCommandServer = "StartCommandServer"
+ CreateService = "CreateService"
+)
+
+func convert2OldState(newStatus pb.CoreState) string {
+ if newStatus == pb.CoreState_STOPPED {
+ return Stopped
+ }
+ if newStatus == pb.CoreState_STARTED {
+ return Started
+ }
+ if newStatus == pb.CoreState_STARTING {
+ return Starting
+ }
+ if newStatus == pb.CoreState_STOPPING {
+ return Stopping
+ }
+ return "Invalid"
+}
+
+type StatusMessage struct {
+ Status string `json:"status"`
+ Alert *string `json:"alert"`
+ Message *string `json:"message"`
+}
diff --git a/v2/service.go b/v2/service.go
index 4ec4af3..7848d8a 100644
--- a/v2/service.go
+++ b/v2/service.go
@@ -2,13 +2,16 @@ package v2
import (
"context"
+ "io"
"os"
"runtime"
runtimeDebug "runtime/debug"
+ "time"
B "github.com/sagernet/sing-box"
"github.com/sagernet/sing-box/common/urltest"
"github.com/sagernet/sing-box/experimental/libbox"
+ "github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/service"
@@ -17,13 +20,15 @@ import (
)
var (
- sWorkingPath string
- sTempPath string
- sUserID int
- sGroupID int
+ sWorkingPath string
+ sTempPath string
+ sUserID int
+ sGroupID int
+ statusPropagationPort int64
)
-func Setup(basePath string, workingPath string, tempPath string) {
+func Setup(basePath string, workingPath string, tempPath string, statusPort int64, debug bool) error {
+ statusPropagationPort = int64(statusPort)
tcpConn := runtime.GOOS == "windows" //TODO add TVOS
libbox.Setup(basePath, workingPath, tempPath, tcpConn)
sWorkingPath = workingPath
@@ -31,6 +36,19 @@ func Setup(basePath string, workingPath string, tempPath string) {
sTempPath = tempPath
sUserID = os.Getuid()
sGroupID = os.Getgid()
+
+ var defaultWriter io.Writer
+ if !debug {
+ defaultWriter = io.Discard
+ }
+ factory, err := log.New(
+ log.Options{
+ DefaultWriter: defaultWriter,
+ BaseTime: time.Now(),
+ Observable: false,
+ })
+ logFactory = &factory
+ return err
}
func NewService(options option.Options) (*libbox.BoxService, error) {
diff --git a/v2/system_proxy.go b/v2/system_proxy.go
new file mode 100644
index 0000000..af359ea
--- /dev/null
+++ b/v2/system_proxy.go
@@ -0,0 +1,44 @@
+package v2
+
+import (
+ "context"
+
+ pb "github.com/hiddify/libcore/hiddifyrpc"
+ "github.com/sagernet/sing-box/experimental/libbox"
+)
+
+func (s *CoreService) GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) {
+ return GetSystemProxyStatus(ctx, empty)
+}
+func GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) {
+ status, err := libbox.NewStandaloneCommandClient().GetSystemProxyStatus()
+
+ if err != nil {
+ return nil, err
+ }
+
+ return &pb.SystemProxyStatus{
+ Available: status.Available,
+ Enabled: status.Enabled,
+ }, nil
+}
+
+func (s *CoreService) SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) {
+ return SetSystemProxyEnabled(ctx, in)
+}
+func SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) {
+ err := libbox.NewStandaloneCommandClient().SetSystemProxyEnabled(in.IsEnabled)
+
+ if err != nil {
+ return &pb.Response{
+ ResponseCode: pb.ResponseCode_FAILED,
+ Message: err.Error(),
+ }, err
+ }
+
+ return &pb.Response{
+ ResponseCode: pb.ResponseCode_OK,
+ Message: "",
+ }, nil
+
+}
diff --git a/v2/warp.go b/v2/warp.go
index ffc91b8..5db9ffa 100644
--- a/v2/warp.go
+++ b/v2/warp.go
@@ -5,10 +5,12 @@ import (
"github.com/hiddify/libcore/config"
pb "github.com/hiddify/libcore/hiddifyrpc"
- "github.com/sagernet/sing-box/experimental/libbox"
)
-func (s *server) GenerateWarpConfig(ctx context.Context, in *pb.GenerateWarpConfigRequest) (*pb.WarpGenerationResponse, error) {
+func (s *CoreService) GenerateWarpConfig(ctx context.Context, in *pb.GenerateWarpConfigRequest) (*pb.WarpGenerationResponse, error) {
+ return GenerateWarpConfig(in)
+}
+func GenerateWarpConfig(in *pb.GenerateWarpConfigRequest) (*pb.WarpGenerationResponse, error) {
account, log, wg, err := config.GenerateWarpInfo(in.LicenseKey, in.AccountId, in.AccessToken)
if err != nil {
return nil, err
@@ -27,39 +29,3 @@ func (s *server) GenerateWarpConfig(ctx context.Context, in *pb.GenerateWarpConf
Log: log,
}, nil
}
-
-// Implement the GetSystemProxyStatus method
-func (s *server) GetSystemProxyStatus(ctx context.Context, empty *pb.Empty) (*pb.SystemProxyStatus, error) {
- status, err := libbox.NewStandaloneCommandClient().GetSystemProxyStatus()
-
- if err != nil {
- return nil, err
- }
-
- return &pb.SystemProxyStatus{
- Available: status.Available,
- Enabled: status.Enabled,
- }, nil
-}
-
-// Implement the SetSystemProxyEnabled method
-func (s *server) SetSystemProxyEnabled(ctx context.Context, in *pb.SetSystemProxyEnabledRequest) (*pb.Response, error) {
- err := libbox.NewStandaloneCommandClient().SetSystemProxyEnabled(in.IsEnabled)
-
- if err != nil {
- return nil, err
- }
-
- if err != nil {
- return &pb.Response{
- ResponseCode: pb.ResponseCode_FAILED,
- Message: err.Error(),
- }, err
- }
-
- return &pb.Response{
- ResponseCode: pb.ResponseCode_OK,
- Message: "",
- }, nil
-
-}