sing-box/common/settings/proxy_windows.go

18 lines
432 B
Go
Raw Permalink Normal View History

package settings
import (
2022-08-04 22:01:20 +08:00
"github.com/sagernet/sing-box/adapter"
F "github.com/sagernet/sing/common/format"
2022-07-17 15:11:26 +08:00
"github.com/sagernet/sing/common/wininet"
)
2022-08-04 22:01:20 +08:00
func SetSystemProxy(router adapter.Router, port uint16, isMixed bool) (func() error, error) {
err := wininet.SetSystemProxy(F.ToString("http://127.0.0.1:", port), "")
2022-08-04 22:01:20 +08:00
if err != nil {
return nil, err
}
return func() error {
return wininet.ClearSystemProxy()
}, nil
}