diff --git a/go.mod b/go.mod index 1cf2b8ab..e6766f78 100644 --- a/go.mod +++ b/go.mod @@ -303,7 +303,7 @@ require ( lukechampine.com/blake3 v1.3.0 // indirect ) -replace github.com/sagernet/sing-box => github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110203637-1f1d31677f7f +replace github.com/sagernet/sing-box => github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110212006-072230aff370 replace github.com/xtls/xray-core => github.com/hiddify/xray-core v0.0.0-20241110202159-0fd7ffea9361 diff --git a/go.sum b/go.sum index 5acaf9b7..43806e0b 100644 --- a/go.sum +++ b/go.sum @@ -244,8 +244,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb h1:PGufWXXDq9yaev6xX1YQauaO1MV90e6Mpoq1I7Lz/VM= github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= -github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110203637-1f1d31677f7f h1:3PqROrv7EjQKUTQLsG85MwXC6pRUcrx3qQp+eLXfjKc= -github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110203637-1f1d31677f7f/go.mod h1:up1OUi36rUNxeEGjXBXwp4J1Kemsm0OKg5X98Asilew= +github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110212006-072230aff370 h1:WtOPowBBdE5V6UfMSIzYdrLG/go6lQqRnXhWVbaQyOs= +github.com/hiddify/hiddify-sing-box v1.8.9-0.20241110212006-072230aff370/go.mod h1:up1OUi36rUNxeEGjXBXwp4J1Kemsm0OKg5X98Asilew= github.com/hiddify/ray2sing v0.0.0-20241110203152-4c6984597d36 h1:jOXVV76YjIqOEgna1hf6TdVRdzufR4bVzauS349qZ9s= github.com/hiddify/ray2sing v0.0.0-20241110203152-4c6984597d36/go.mod h1:soYE48y/Q2HtgRFpcX6LcekVyigy7IELYw4fmIGwLSA= github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d h1:vRGKh9ou+/vQGfVYa8MczhbIVjHxlP52OWwrDWO77RA= diff --git a/v2/hcore/service.go b/v2/hcore/service.go index 01af493c..0413a768 100644 --- a/v2/hcore/service.go +++ b/v2/hcore/service.go @@ -59,7 +59,8 @@ func Setup(params *SetupRequest) error { } tcpConn := runtime.GOOS == "windows" // TODO add TVOS libbox.Setup(params.BasePath, params.WorkingDir, params.TempDir, tcpConn) - libbox.RedirectStderr(fmt.Sprint(params.WorkingDir, "/data/stderr.log")) + hutils.RedirectStderr(fmt.Sprint(params.WorkingDir, "/data/stderr.log")) + Log(LogLevel_DEBUG, LogType_CORE, fmt.Sprintf("libbox.Setup success %s %s %s %v", params.BasePath, params.WorkingDir, params.TempDir, tcpConn)) sWorkingPath = params.WorkingDir diff --git a/v2/hutils/andorid_utils.go b/v2/hutils/andorid_utils.go new file mode 100644 index 00000000..d02b3be3 --- /dev/null +++ b/v2/hutils/andorid_utils.go @@ -0,0 +1,9 @@ +//go:build android + +package hutils + +import "github.com/sagernet/sing-box/experimental/libbox" + +func RedirectStderr(path string) error { + return libbox.RedirectStderr(path) +} diff --git a/v2/hutils/darwin_utils.go b/v2/hutils/darwin_utils.go new file mode 100644 index 00000000..9924419d --- /dev/null +++ b/v2/hutils/darwin_utils.go @@ -0,0 +1,9 @@ +//go:build darwin + +package hutils + +import "github.com/sagernet/sing-box/experimental/libbox" + +func RedirectStderr(path string) error { + return libbox.RedirectStderr(path) +} diff --git a/v2/hutils/linux_utils.go b/v2/hutils/linux_utils.go index dff64e82..e5827091 100644 --- a/v2/hutils/linux_utils.go +++ b/v2/hutils/linux_utils.go @@ -9,9 +9,14 @@ import ( "path/filepath" "strings" + "github.com/sagernet/sing-box/experimental/libbox" "golang.org/x/sys/unix" ) +func RedirectStderr(path string) error { + return libbox.RedirectStderr(path) +} + func IsAdmin() bool { return os.Getuid() == 0 } diff --git a/v2/hutils/windows_utils.go b/v2/hutils/windows_utils.go index edcb4b2f..d0417d15 100644 --- a/v2/hutils/windows_utils.go +++ b/v2/hutils/windows_utils.go @@ -3,6 +3,7 @@ package hutils import ( + "fmt" "os" "strings" "syscall" @@ -12,6 +13,10 @@ import ( "golang.org/x/sys/windows" ) +func RedirectStderr(path string) error { + return fmt.Errorf("not supported on windows") +} + func IsAdmin() bool { adminSID, err := windows.CreateWellKnownSid(windows.WinBuiltinAdministratorsSid) if err != nil {