MCPcopy Index your code
hub / github.com/getlantern/sysproxy / EnsureHelperToolPresent

Function EnsureHelperToolPresent

sysproxy.go:30–41  ·  view source on GitHub ↗

EnsureHelperToolPresent checks if helper tool exists and extracts it if not. On Mac OS, it also checks and set the file's owner to root:wheel and the setuid bit, it will request user to input password through a dialog to gain the rights to do so. path: absolute or relative path of the file to be che

(path string, prompt string, iconFullPath string)

Source from the content-addressed store, hash-verified

28// prompt: the message to be shown on the dialog.
29// iconPath: the full path of the icon to be shown on the dialog.
30func EnsureHelperToolPresent(path string, prompt string, iconFullPath string) (err error) {
31 mu.Lock()
32 defer mu.Unlock()
33 if len(sysproxy) == 0 {
34 return fmt.Errorf("unable to find binary: %v", sysproxy)
35 }
36 be, err = byteexec.New(sysproxy, path)
37 if err != nil {
38 return fmt.Errorf("unable to extract helper tool: %v", err)
39 }
40 return ensureElevatedOnDarwin(be, prompt, iconFullPath)
41}
42
43// On tells OS to configure proxy through `addr` as host:port. It always returns
44// a function that can be used to clear the system proxy setting. If the current

Callers 2

mainFunction · 0.92
TestGetOutputFunction · 0.85

Calls 1

ensureElevatedOnDarwinFunction · 0.70

Tested by 1

TestGetOutputFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…