Files
sing-box-extended-mirror/common/settings/proxy_windows.go
T

18 lines
432 B
Go
Raw Normal View History

2022-07-14 20:30:57 +08:00
package settings
2022-07-14 14:04:57 +08:00
import (
2022-08-04 22:01:20 +08:00
"github.com/sagernet/sing-box/adapter"
2022-07-14 20:30:57 +08:00
F "github.com/sagernet/sing/common/format"
2022-07-17 15:11:26 +08:00
"github.com/sagernet/sing/common/wininet"
2022-07-14 14:04:57 +08:00
)
2022-08-04 22:01:20 +08:00
func SetSystemProxy(router adapter.Router, port uint16, isMixed bool) (func() error, error) {
2022-12-26 12:33:08 +08:00
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
2022-07-14 14:04:57 +08:00
}