MCPcopy Create free account
hub / github.com/SamNet-dev/snix / detectSingBox

Function detectSingBox

integrate/integrate.go:178–194  ·  view source on GitHub ↗

-- sing-box (JSON with typed outbounds) ---------------------------------

()

Source from the content-addressed store, hash-verified

176// -- sing-box (JSON with typed outbounds) ---------------------------------
177
178func detectSingBox() (Client, bool) {
179 bin, err := exec.LookPath("sing-box")
180 if err != nil {
181 return Client{}, false
182 }
183 for _, p := range singBoxConfigPaths() {
184 if _, err := os.Stat(p); err == nil {
185 return Client{
186 Name: "sing-box",
187 Binary: bin,
188 ConfigPath: p,
189 Patch: singBoxPatcher(p),
190 }, true
191 }
192 }
193 return Client{}, false
194}
195
196func singBoxPatcher(path string) func(string, uint16) error {
197 return func(origHost string, origPort uint16) error {

Callers 1

DetectFunction · 0.85

Calls 2

singBoxConfigPathsFunction · 0.85
singBoxPatcherFunction · 0.85

Tested by

no test coverage detected