mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-27 05:01:45 +00:00
37 lines
597 B
Go
37 lines
597 B
Go
package proxy
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/Baipyrus/ProxySwitcher/util"
|
|
)
|
|
|
|
func Unset() {
|
|
stdin, closeFunc, _ := util.ReadyCmd()
|
|
|
|
// Unset system proxy, if not already
|
|
proxy, err := ReadSystemProxy()
|
|
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if proxy.Enabled {
|
|
SetSystemProxy(false)
|
|
}
|
|
|
|
configs, _ := util.ReadConfigs()
|
|
for _, config := range configs {
|
|
configCmd := config.Name
|
|
// Use command instead of name, if given
|
|
if config.Cmd != "" {
|
|
configCmd = config.Cmd
|
|
}
|
|
|
|
commands := generateCommands(config.Unset, configCmd, "")
|
|
util.ExecCmds(commands, stdin)
|
|
}
|
|
|
|
closeFunc()
|
|
}
|