sing-box/common/settings/proxy_windows.go

18 lines
437 B
Go
Raw Normal View History

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