Skip to content

Commit

Permalink
fix: Redrect Std error not supported in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
x committed Nov 10, 2024
1 parent e895661 commit 6a33969
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
3 changes: 2 additions & 1 deletion v2/hcore/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-core-windows-amd64, ubuntu-latest, windows-amd64, x64)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-core-macos, macos-12, macos)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-core-macos, macos-12, macos)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-amd64, linux, amd64, v1, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-amd64-v3, linux, amd64, v3, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-386, linux, 386, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-arm64, linux, arm64, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-armv5, linux, arm, 5, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-armv6, linux, arm, 6, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-armv7, linux, arm, 7, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-mips-softfloat, linux, mips, softfloat, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-mips-hardfloat, linux, mips, hardfloat, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-mipsel-softfloat, linux, mipsle, softfloat, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-mipsel-hardfloat, linux, mipsle, hardfloat, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-mips64, linux, mips64, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-mips64el, linux, mips64le, linux-custom, ubuntu-20.04)

undefined: hutils

Check failure on line 62 in v2/hcore/service.go

View workflow job for this annotation

GitHub Actions / run / build (hiddify-cli-linux-s390x, linux, s390x, linux-custom, ubuntu-20.04)

undefined: hutils

Log(LogLevel_DEBUG, LogType_CORE, fmt.Sprintf("libbox.Setup success %s %s %s %v", params.BasePath, params.WorkingDir, params.TempDir, tcpConn))

sWorkingPath = params.WorkingDir
Expand Down
9 changes: 9 additions & 0 deletions v2/hutils/andorid_utils.go
Original file line number Diff line number Diff line change
@@ -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)
}
9 changes: 9 additions & 0 deletions v2/hutils/darwin_utils.go
Original file line number Diff line number Diff line change
@@ -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)
}
5 changes: 5 additions & 0 deletions v2/hutils/linux_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions v2/hutils/windows_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package hutils

import (
"fmt"
"os"
"strings"
"syscall"
Expand All @@ -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 {
Expand Down

0 comments on commit 6a33969

Please sign in to comment.