Add set system proxy support for macOS
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
F "github.com/sagernet/sing/common/format"
|
||||
"github.com/sagernet/sing/common/wininet"
|
||||
)
|
||||
|
||||
func ClearSystemProxy() error {
|
||||
return wininet.ClearSystemProxy()
|
||||
}
|
||||
|
||||
func SetSystemProxy(port uint16, mixed bool) error {
|
||||
return wininet.SetSystemProxy(F.ToString("http://127.0.0.1:", port), "local")
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user