Release 3.8.0.1: unify apphost, harden lifecycle and core SHA checks.

This commit is contained in:
M4
2026-07-29 21:43:41 +03:00
parent 64c097d1e7
commit 54b5b87990
26 changed files with 534 additions and 619 deletions
+13 -1
View File
@@ -5,6 +5,7 @@ package sysproxy
import (
"fmt"
"strings"
"sync"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
@@ -16,6 +17,7 @@ const (
)
type windowsController struct {
mu sync.Mutex
enabled bool
hadProxy bool
oldEnable uint64
@@ -27,9 +29,15 @@ func newPlatform() Controller {
return &windowsController{}
}
func (c *windowsController) Enabled() bool { return c.enabled }
func (c *windowsController) Enabled() bool {
c.mu.Lock()
defer c.mu.Unlock()
return c.enabled
}
func (c *windowsController) Enable(httpHostPort string) error {
c.mu.Lock()
defer c.mu.Unlock()
if httpHostPort == "" {
return fmt.Errorf("sysproxy: empty http proxy address")
}
@@ -92,6 +100,8 @@ func (c *windowsController) Enable(httpHostPort string) error {
}
func (c *windowsController) Disable() error {
c.mu.Lock()
defer c.mu.Unlock()
if !c.enabled {
return nil
}
@@ -99,6 +109,8 @@ func (c *windowsController) Disable() error {
}
func (c *windowsController) ForceDisable() error {
c.mu.Lock()
defer c.mu.Unlock()
return c.disableLocked(false)
}