From 13a6be47a40fe1dafdb8ba29b738e85bd656b9df Mon Sep 17 00:00:00 2001 From: wweir Date: Mon, 13 Jul 2020 13:45:33 +0800 Subject: [PATCH] fix windows and daewin support --- conf/conf_darwin.go | 8 -------- conf/conf_windows.go | 2 +- go.mod | 1 + proxy/socks5.go | 1 + 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/conf/conf_darwin.go b/conf/conf_darwin.go index 7a26c3e..817e98b 100644 --- a/conf/conf_darwin.go +++ b/conf/conf_darwin.go @@ -66,14 +66,6 @@ func afterInitFlag() { case uninstallFlag: uninstall() default: - if conf.Client.DNSServeIP != "" { - log.Infow("setting system DNS", "DNS", conf.Client.DNSServeIP) - if err := execute("networksetup -listallnetworkservices | grep -v '*' | xargs -I {} " + - "networksetup -setdnsservers {} " + conf.Client.DNSServeIP); err != nil { - log.Errorf("set DNS fail, please set DNS to %s manually", conf.Client.DNSServeIP) - } - execute("pkill mDNSResponder") - } return } os.Exit(0) diff --git a/conf/conf_windows.go b/conf/conf_windows.go index c73718a..4854f65 100644 --- a/conf/conf_windows.go +++ b/conf/conf_windows.go @@ -50,7 +50,7 @@ func afterInitFlag() { func runAsService() { os.Chdir(filepath.Dir(os.Args[0])) if active, err := svc.IsAnInteractiveSession(); err != nil { - log.Fatalf("failed to determine if we are running in an interactive session: %v", err) + log.Fatalw("failed to determine if we are running in an interactive session", "err", err) } else if !active { go func() { elog, err := eventlog.Open(name) diff --git a/go.mod b/go.mod index 513a061..90a4df5 100644 --- a/go.mod +++ b/go.mod @@ -11,5 +11,6 @@ require ( github.com/wweir/util-go/log v0.0.0-20200701032032-3cff7b4a46ea github.com/wweir/util-go/mem v0.0.0-20200701032032-3cff7b4a46ea golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 + golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 ) diff --git a/proxy/socks5.go b/proxy/socks5.go index 79b4f18..5060a33 100644 --- a/proxy/socks5.go +++ b/proxy/socks5.go @@ -13,6 +13,7 @@ func StartSocks5Proxy(listenAddr, serverAddr string, password []byte) { log.Fatalw("socks5 proxy", "addr", listenAddr, "err", err) } + log.Infow("start socks5 proxy", "endpoint", listenAddr) serveSocks5(ln, serverAddr, password) }