From 86bf48fdf0cefe3f9d2db23e9afadd0f2780d7c6 Mon Sep 17 00:00:00 2001 From: Cloud Date: Sat, 26 Aug 2017 12:57:34 +0800 Subject: [PATCH] always change system proxy --- README.md | 28 ++++++++++++++-------------- cli/brook/main.go | 2 +- gui/main.go | 9 +++------ sysproxy/system_darwin.go | 11 +---------- 4 files changed, 19 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 9662964f..89eba6d8 100644 --- a/README.md +++ b/README.md @@ -30,20 +30,20 @@ Brook's goal is to reduce the configuration steps. Keep it simple, stupid. | Download | Server/Client | OS | Arch | Remark | | --- | --- | --- | --- | --- | -| [brook](https://github.com/txthinking/brook/releases/download/v20170814/brook) | Server & Client | Linux | amd64 | CLI | -| [brook_linux_386](https://github.com/txthinking/brook/releases/download/v20170814/brook_linux_386) | Server & Client | Linux | 386 | CLI | -| [brook_linux_arm64](https://github.com/txthinking/brook/releases/download/v20170814/brook_linux_arm64) | Server & Client | Linux | arm64 | CLI | -| [brook_linux_arm5](https://github.com/txthinking/brook/releases/download/v20170814/brook_linux_arm5) | Server & Client | Linux | arm5 | CLI | -| [brook_linux_arm6](https://github.com/txthinking/brook/releases/download/v20170814/brook_linux_arm6) | Server & Client | Linux | arm6 | CLI | -| [brook_linux_arm7](https://github.com/txthinking/brook/releases/download/v20170814/brook_linux_arm7) | Server & Client | Linux | arm7 | CLI | -| [brook_macos_amd64](https://github.com/txthinking/brook/releases/download/v20170814/brook_macos_amd64) | Server & Client | MacOS | amd64 | CLI | -| [brook_windows_amd64.exe](https://github.com/txthinking/brook/releases/download/v20170814/brook_windows_amd64.exe) | Server & Client | Windows | amd64 | CLI | -| [brook_windows_386.exe](https://github.com/txthinking/brook/releases/download/v20170814/brook_windows_386.exe) | Server & Client | Windows | 386 | CLI | -| [Brook.app.zip](https://github.com/txthinking/brook/releases/download/v20170814/Brook.app.zip) | Client | MacOS | amd64 | GUI | -| [Brook.exe](https://github.com/txthinking/brook/releases/download/v20170814/Brook.exe) | Client | Windows | amd64 | GUI | -| [Brook.386.exe](https://github.com/txthinking/brook/releases/download/v20170814/Brook.386.exe) | Client | Windows | 386 | GUI | +| [brook](https://github.com/txthinking/brook/releases/download/v20170826/brook) | Server & Client | Linux | amd64 | CLI | +| [brook_linux_386](https://github.com/txthinking/brook/releases/download/v20170826/brook_linux_386) | Server & Client | Linux | 386 | CLI | +| [brook_linux_arm64](https://github.com/txthinking/brook/releases/download/v20170826/brook_linux_arm64) | Server & Client | Linux | arm64 | CLI | +| [brook_linux_arm5](https://github.com/txthinking/brook/releases/download/v20170826/brook_linux_arm5) | Server & Client | Linux | arm5 | CLI | +| [brook_linux_arm6](https://github.com/txthinking/brook/releases/download/v20170826/brook_linux_arm6) | Server & Client | Linux | arm6 | CLI | +| [brook_linux_arm7](https://github.com/txthinking/brook/releases/download/v20170826/brook_linux_arm7) | Server & Client | Linux | arm7 | CLI | +| [brook_macos_amd64](https://github.com/txthinking/brook/releases/download/v20170826/brook_macos_amd64) | Server & Client | MacOS | amd64 | CLI | +| [brook_windows_amd64.exe](https://github.com/txthinking/brook/releases/download/v20170826/brook_windows_amd64.exe) | Server & Client | Windows | amd64 | CLI | +| [brook_windows_386.exe](https://github.com/txthinking/brook/releases/download/v20170826/brook_windows_386.exe) | Server & Client | Windows | 386 | CLI | +| [Brook.app.zip](https://github.com/txthinking/brook/releases/download/v20170826/Brook.app.zip) | Client | MacOS | amd64 | GUI | +| [Brook.exe](https://github.com/txthinking/brook/releases/download/v20170826/Brook.exe) | Client | Windows | amd64 | GUI | +| [Brook.386.exe](https://github.com/txthinking/brook/releases/download/v20170826/Brook.386.exe) | Client | Windows | 386 | GUI | | [App Store](https://itunes.apple.com/us/app/brook-brook-shadowsocks-vpn-proxy/id1216002642) | Client | iOS | - | GUI | -| [Google Play](https://play.google.com/store/apps/details?id=com.txthinking.brook) / [Brook.apk](https://github.com/txthinking/brook/releases/download/v20170814/Brook.apk) | Client | Android | - | GUI | +| [Google Play](https://play.google.com/store/apps/details?id=com.txthinking.brook) / [Brook.apk](https://github.com/txthinking/brook/releases/download/v20170826/Brook.apk) | Client | Android | - | GUI | MacOS GUI Client @@ -80,7 +80,7 @@ USAGE: brook [global options] command [command options] [arguments...] VERSION: - 20170814 + 20170826 AUTHOR: Cloud diff --git a/cli/brook/main.go b/cli/brook/main.go index 7a98e607..032e6dc6 100644 --- a/cli/brook/main.go +++ b/cli/brook/main.go @@ -19,7 +19,7 @@ var debugAddress string func main() { app := cli.NewApp() app.Name = "Brook" - app.Version = "20170814" + app.Version = "20170826" app.Usage = "A Cross-Platform Proxy Software" app.Author = "Cloud" app.Email = "cloud@txthinking.com" diff --git a/gui/main.go b/gui/main.go index a42ba88f..c89c2daf 100644 --- a/gui/main.go +++ b/gui/main.go @@ -2,7 +2,6 @@ package main import ( "os" - "runtime" "github.com/getlantern/systray" "github.com/skratchdot/open-golang/open" @@ -40,7 +39,7 @@ func run() { systray.AddMenuItem("---------", "").Disable() mGithub := systray.AddMenuItem("Upgrade", "") mEmail := systray.AddMenuItem("Contact: cloud@txthinking.com", "") - systray.AddMenuItem("Version: 20170814", "") + systray.AddMenuItem("Version: 20170826", "") systray.AddMenuItem("---------", "").Disable() mQuit := systray.AddMenuItem("Quit", "") @@ -98,10 +97,8 @@ func run() { } stop := func() error { - if runtime.GOOS == "windows" { - if err := sysproxy.TurnOffSystemProxy(); err != nil { - return err - } + if err := sysproxy.TurnOffSystemProxy(); err != nil { + return err } if bk != nil { bk.Shutdown() diff --git a/sysproxy/system_darwin.go b/sysproxy/system_darwin.go index ae8ea546..1b9b4b6d 100644 --- a/sysproxy/system_darwin.go +++ b/sysproxy/system_darwin.go @@ -8,7 +8,6 @@ import ( "errors" "os/exec" "regexp" - "strings" ) func getNetworkServices() ([]string, error) { @@ -48,15 +47,7 @@ func TurnOnSystemProxy(pac string) error { return err } for _, v := range nss { - c := exec.Command("networksetup", "-getautoproxyurl", v) - out, err := c.CombinedOutput() - if err != nil { - return errors.New("ns apu:" + string(out) + ":" + err.Error()) - } - if strings.Contains(string(out), pac) && strings.Contains(string(out), "Yes") { - continue - } - c = exec.Command("networksetup", "-setautoproxyurl", v, pac) + c := exec.Command("networksetup", "-setautoproxyurl", v, pac) if out, err := c.CombinedOutput(); err != nil { return errors.New("ns apu:" + string(out) + ":" + err.Error()) }