2024-08-31 16:01:58 +00:00
|
|
|
package proxy
|
|
|
|
|
2024-08-31 16:27:57 +00:00
|
|
|
import (
|
|
|
|
"github.com/Baipyrus/ProxySwitcher/util"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Unset() {
|
|
|
|
stdin, closeFunc, _ := util.ReadyCmd()
|
|
|
|
|
2024-08-31 17:13:01 +00:00
|
|
|
// Unset system proxy, if not already
|
2024-09-12 21:19:57 +00:00
|
|
|
proxy, _ := ReadSystemProxy()
|
2024-08-31 16:27:57 +00:00
|
|
|
if proxy.Enabled {
|
|
|
|
SetSystemProxy(false)
|
|
|
|
}
|
|
|
|
|
|
|
|
configs, _ := util.ReadConfigs()
|
|
|
|
for _, config := range configs {
|
|
|
|
configCmd := config.Name
|
2024-08-31 17:13:01 +00:00
|
|
|
// Use command instead of name, if given
|
2024-08-31 16:27:57 +00:00
|
|
|
if config.Cmd != "" {
|
|
|
|
configCmd = config.Cmd
|
|
|
|
}
|
|
|
|
|
2024-08-31 17:13:01 +00:00
|
|
|
commands := generateCommands(config.Unset, configCmd, "")
|
|
|
|
util.ExecCmds(commands, stdin)
|
2024-08-31 16:27:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
closeFunc()
|
2024-08-31 16:01:58 +00:00
|
|
|
}
|