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

Method refreshVersion

backend/xray/core.go:92–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90}
91
92func (c *Core) refreshVersion() (string, error) {
93 cmd := exec.Command(c.executablePath, "version")
94 var out bytes.Buffer
95 cmd.Stdout = &out
96 err := cmd.Run()
97 if err != nil {
98 return "", err
99 }
100
101 r := regexp.MustCompile(`^Xray (\d+\.\d+\.\d+)`)
102 matches := r.FindStringSubmatch(out.String())
103 if len(matches) > 1 {
104 return matches[1], nil
105 }
106
107 return "", errors.New("could not parse Xray version")
108}
109
110func (c *Core) Version() string {
111 c.mu.Lock()

Callers 1

NewXRayCoreFunction · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected