Release 1.7.1: download-only updates and remove netsh/startup network probes for AV FPs.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,9 +4,7 @@ package sysproxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
"golang.org/x/sys/windows/registry"
|
||||
@@ -87,7 +85,7 @@ func (c *windowsController) Enable(httpHostPort string) error {
|
||||
if err := notifyInternetSettingsChanged(); err != nil {
|
||||
return err
|
||||
}
|
||||
_ = setWinHTTPProxy(httpHostPort)
|
||||
// Skip netsh winhttp — spawning netsh is a common AV heuristic; WinINET covers browsers.
|
||||
|
||||
c.enabled = true
|
||||
return nil
|
||||
@@ -120,7 +118,6 @@ func (c *windowsController) Disable() error {
|
||||
}
|
||||
|
||||
_ = notifyInternetSettingsChanged()
|
||||
_ = resetWinHTTPProxy()
|
||||
|
||||
c.enabled = false
|
||||
return nil
|
||||
@@ -139,18 +136,3 @@ func notifyInternetSettingsChanged() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setWinHTTPProxy(httpHostPort string) error {
|
||||
cmd := exec.Command("netsh", "winhttp", "set", "proxy", httpHostPort,
|
||||
"bypass-list=localhost;127.*;10.*;192.168.*;<local>")
|
||||
const createNoWindow = 0x08000000
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{CreationFlags: createNoWindow}
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func resetWinHTTPProxy() error {
|
||||
cmd := exec.Command("netsh", "winhttp", "reset", "proxy")
|
||||
const createNoWindow = 0x08000000
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{CreationFlags: createNoWindow}
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user