mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 22:36:53 +00:00
fix #21
This commit is contained in:
parent
9143073d7c
commit
d15a24a2a1
13
util/os.go
13
util/os.go
@ -11,17 +11,18 @@ func SetOsProxy(port string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
network, err := exec.Command("sh", "-c", "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep 'interface' | cut -d ':' -f2` -B 1 | head -n 1 | cut -d ' ' -f2").Output()
|
network, err := exec.Command("sh", "-c", "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep 'interface' | cut -d ':' -f2` -B 1 | head -n 1 | cut -d ' ' -f 2-").Output()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = exec.Command("sh", "-c", "networksetup -setwebproxy "+strings.TrimSpace(string(network))+" 127.0.0.1 "+port).Output()
|
_, err = exec.Command("sh", "-c", "networksetup -setwebproxy "+ "'" +strings.TrimSpace(string(network)) + "'" + " 127.0.0.1 "+port).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = exec.Command("sh", "-c", "networksetup -setsecurewebproxy "+strings.TrimSpace(string(network))+" 127.0.0.1 "+port).Output()
|
_, err = exec.Command("sh", "-c", "networksetup -setsecurewebproxy " + "'" + strings.TrimSpace(string(network))+"'" + " 127.0.0.1 "+port).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -34,17 +35,17 @@ func UnsetOsProxy() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
network, err := exec.Command("sh", "-c", "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep 'interface' | cut -d ':' -f2` -B 1 | head -n 1 | cut -d ' ' -f2").Output()
|
network, err := exec.Command("sh", "-c", "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep 'interface' | cut -d ':' -f2` -B 1 | head -n 1 | cut -d ' ' -f 2-").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = exec.Command("sh", "-c", "networksetup -setwebproxystate "+strings.TrimSpace(string(network))+" off").Output()
|
_, err = exec.Command("sh", "-c", "networksetup -setwebproxystate " + "'" + strings.TrimSpace(string(network)) + "'" + " off").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = exec.Command("sh", "-c", "networksetup -setsecurewebproxystate "+strings.TrimSpace(string(network))+" off").Output()
|
_, err = exec.Command("sh", "-c", "networksetup -setsecurewebproxystate " + "'" + strings.TrimSpace(string(network)) + "'" + " off").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user