MCPcopy Create free account
hub / github.com/PasarGuard/node / resolveXrayBinary

Function resolveXrayBinary

backend/xray/process_unix_test.go:58–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func resolveXrayBinary(t *testing.T) string {
59 t.Helper()
60
61 candidates := []string{}
62 if envPath := os.Getenv("XRAY_EXECUTABLE_PATH"); envPath != "" {
63 candidates = append(candidates, envPath)
64 }
65 candidates = append(candidates, "/usr/local/bin/xray")
66
67 for _, path := range candidates {
68 if path == "" {
69 continue
70 }
71 info, err := os.Stat(path)
72 if err != nil {
73 continue
74 }
75 if info.Mode().IsRegular() && info.Mode().Perm()&0111 != 0 {
76 return path
77 }
78 }
79
80 t.Skip("xray binary not found; set XRAY_EXECUTABLE_PATH to a valid xray executable")
81 return ""
82}
83
84func startXrayProcess(t *testing.T, exe string) (pid int, waitCh <-chan error) {
85 t.Helper()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected