proxy_windows.go 439 B

1234567891011121314151617
  1. package settings
  2. import (
  3. "github.com/sagernet/sing-box/adapter"
  4. F "github.com/sagernet/sing/common/format"
  5. "github.com/sagernet/sing/common/wininet"
  6. )
  7. func SetSystemProxy(router adapter.Router, port uint16, isMixed bool) (func() error, error) {
  8. err := wininet.SetSystemProxy(F.ToString("http://127.0.0.1:", port), "<local>")
  9. if err != nil {
  10. return nil, err
  11. }
  12. return func() error {
  13. return wininet.ClearSystemProxy()
  14. }, nil
  15. }