platform: Add http proxy support for Windows

This commit is contained in:
世界
2026-08-30 17:41:42 +08:00
parent 9eb60234fc
commit 4f330d73ec
24 changed files with 862 additions and 72 deletions
+29 -4
View File
@@ -52,14 +52,39 @@ func (h *managedHandler) ServiceReload() error {
}
func (h *managedHandler) SystemProxyStatus() (*daemon.SystemProxyStatus, error) {
return &daemon.SystemProxyStatus{}, nil
if h.daemon.platform == nil {
return &daemon.SystemProxyStatus{}, nil
}
return h.daemon.platform.SystemProxyStatus()
}
func (h *managedHandler) SetSystemProxyEnabled(enabled bool) error {
if !enabled {
return nil
if h.daemon.platform == nil {
if !enabled {
return nil
}
return status.Error(codes.FailedPrecondition, "the system proxy is not available")
}
return status.Error(codes.FailedPrecondition, "the system proxy is not available")
ownerUserID, err := loadOwner()
if err != nil {
return err
}
options, err := loadStartOptions(ownerUserID)
if err != nil {
return err
}
previousEnabled := options.systemProxyEnabled()
err = h.daemon.platform.SetSystemProxyEnabled(enabled)
if err != nil {
return err
}
options.SystemProxyEnabled = &enabled
err = saveStartOptions(ownerUserID, options)
if err != nil {
rollbackError := h.daemon.platform.SetSystemProxyEnabled(previousEnabled)
return E.Errors(err, rollbackError)
}
return nil
}
func (h *managedHandler) TriggerNativeCrash() error {