Release 3.8.0.1: unify apphost, harden lifecycle and core SHA checks.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user