sing-box/common/settings/proxy_windows.go

18 lines
439 B
Go
Raw 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) {
2022-08-06 17:28:51 +08:00
err := wininet.SetSystemProxy(F.ToString("http://127.0.0.1:", port), "<local>")
2022-08-04 22:01:20 +08:00
if err != nil {
return nil, err
}
return func() error {
return wininet.ClearSystemProxy()
}, nil
}