ProxySwitcher/proxy/unset.go

30 lines
569 B
Go
Raw Permalink Normal View History

2024-08-31 16:01:58 +00:00
package proxy
import (
"github.com/Baipyrus/ProxySwitcher/util"
)
func Unset(cfgFile string) {
stdin, closeFunc, _ := util.ReadyCmd()
proxy, _ := ReadSystemProxy()
// Unset system proxy, if not already
if proxy.Enabled {
SetSystemProxy(false)
}
configs, _ := util.ReadConfigs(cfgFile)
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()
2024-08-31 16:01:58 +00:00
}