From 4681ff3827c41c7d20482e392b10183b5c1cb7f7 Mon Sep 17 00:00:00 2001 From: "arraykeys@gmail.com" Date: Mon, 27 Nov 2017 12:21:59 +0800 Subject: [PATCH] Signed-off-by: arraykeys@gmail.com --- CHANGELOG | 3 +++ README.md | 2 +- config.go | 13 ++++++++++++- install_auto.sh | 2 +- main.go | 2 +- release.sh | 2 +- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6e3376b..cd64371 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,7 @@ proxy更新日志 +v3.8 +1.增加了日志输出到文件--log参数,比如: --log proxy.log,日志就会输出到proxy.log方便排除问题. + v3.7 1.修复了socks代理不能正常和上级代理通讯的问题. diff --git a/README.md b/README.md index f1bda20..2ed72ab 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ wget https://github.com/reddec/monexec/releases/download/v0.1.1/monexec_0.1.1_li 下载地址:https://github.com/snail007/goproxy/releases ```shell cd /root/proxy/ -wget https://github.com/snail007/goproxy/releases/download/v3.7/proxy-linux-amd64.tar.gz +wget https://github.com/snail007/goproxy/releases/download/v3.8/proxy-linux-amd64.tar.gz ``` #### **3.下载自动安装脚本** ```shell diff --git a/config.go b/config.go index d2eec51..87f03f2 100755 --- a/config.go +++ b/config.go @@ -38,6 +38,8 @@ func initConfig() (err error) { app.Author("snail").Version(APP_VERSION) debug := app.Flag("debug", "debug log output").Default("false").Bool() daemon := app.Flag("daemon", "run proxy in background").Default("false").Bool() + logfile := app.Flag("log", "log file path").Default("").String() + //########http######### http := app.Command("http", "proxy on http mode") httpArgs.Parent = http.Flag("parent", "parent address, such as: \"23.32.32.19:28008\"").Default("").Short('P').String() @@ -171,7 +173,16 @@ func initConfig() (err error) { flags |= log.Ltime } log.SetFlags(flags) - poster() + + if *logfile != "" { + f, e := os.OpenFile(*logfile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600) + if e != nil { + log.Fatal(e) + } + log.SetOutput(f) + } else { + poster() + } //regist services and run service services.Regist("http", services.NewHTTP(), httpArgs) services.Regist("tcp", services.NewTCP(), tcpArgs) diff --git a/install_auto.sh b/install_auto.sh index 9993b06..9887e29 100755 --- a/install_auto.sh +++ b/install_auto.sh @@ -6,7 +6,7 @@ fi mkdir /tmp/proxy cd /tmp/proxy wget https://github.com/reddec/monexec/releases/download/v0.1.1/monexec_0.1.1_linux_amd64.tar.gz -wget https://github.com/snail007/goproxy/releases/download/v3.7/proxy-linux-amd64.tar.gz +wget https://github.com/snail007/goproxy/releases/download/v3.8/proxy-linux-amd64.tar.gz # install monexec tar zxvf monexec_0.1.1_linux_amd64.tar.gz diff --git a/main.go b/main.go index 28b3019..01fd68f 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( "syscall" ) -const APP_VERSION = "3.7" +const APP_VERSION = "3.8" func main() { err := initConfig() diff --git a/release.sh b/release.sh index d58d3cc..c45a55d 100755 --- a/release.sh +++ b/release.sh @@ -1,5 +1,5 @@ #!/bin/bash -VER="3.7" +VER="3.8" RELEASE="release-${VER}" rm -rf .cert mkdir .cert