From 956e8fa57be56e703df1acd7e76e51b1fa3b90f8 Mon Sep 17 00:00:00 2001 From: lovedboy Date: Thu, 3 Aug 2017 21:53:22 +0800 Subject: [PATCH] modify readme --- README.md | 14 +++++++------- cmd/local/main.go | 5 ++++- cmd/server/main.go | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d46db75..8a8e9dc 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,13 @@ go get github.com/lovedboy/cracker/local ## Server side (Run on your vps or other application container platform) ``` -./server -addr :8080 -secret +./server -addr :8080 -secret -logtostderr ``` ## Local side (Run on your local pc) ``` -./local -raddr http://example.com:8080 -secret +./local -raddr http://example.com:8080 -secret -logtostderr ``` ## https @@ -50,11 +50,11 @@ It is strongly recommended to open the https option on the server side. If you have a ssl certificate, It would be easy. ``` -./server -addr :443 -secret -https -cert /etc/cert.pem -key /etc/key.pem +./server -addr :443 -secret -https -cert /etc/cert.pem -key /etc/key.pem -logtostderr ``` ``` -./local -raddr https://example.com -secret +./local -raddr https://example.com -secret -logtostderr ``` Of Course, you can create a self-signed ssl certificate by openssl. @@ -64,11 +64,11 @@ sh -c "$(curl https://raw.githubusercontent.com/lovedboy/cracker/master/gen_key_ ``` ``` -./server -addr :443 -secret -https -cert /etc/self-signed-cert.pem -key /etc/self-ca-key.pem +./server -addr :443 -secret -https -cert /etc/self-signed-cert.pem -key /etc/self-ca-key.pem -logtostderr ``` ``` -./local -raddr https://example.com -secret -cert /etc/self-signed-cert.pem +./local -raddr https://example.com -secret -cert /etc/self-signed-cert.pem -logtostderr ``` @@ -77,7 +77,7 @@ sh -c "$(curl https://raw.githubusercontent.com/lovedboy/cracker/master/gen_key_ If you don't want to run the server side, I did for you :) you only need to run the local side. ``` -./local -raddr https://lit-citadel-13724.herokuapp.com -secret 123456 +./local -raddr https://lit-citadel-13724.herokuapp.com -secret 123456 -logtostderr ``` [Deploy the server side on heroku](https://github.com/lovedboy/cracker-heroku) diff --git a/cmd/local/main.go b/cmd/local/main.go index fc48597..2277ee0 100644 --- a/cmd/local/main.go +++ b/cmd/local/main.go @@ -5,6 +5,7 @@ import ( "fmt" "os" + g "github.com/golang/glog" "github.com/ls0f/cracker" p "github.com/ls0f/proxylib" ) @@ -23,6 +24,8 @@ func main() { cert := flag.String("cert", "", "cert file") flag.Parse() + defer g.Flush() + if *version { fmt.Printf("GitTag: %s \n", GitTag) fmt.Printf("BuildTime: %s \n", BuildTime) @@ -39,5 +42,5 @@ func main() { } s.HTTPHandler = handler s.Socks5Handler = handler - s.ListenAndServe() + g.Fatal(s.ListenAndServe()) } diff --git a/cmd/server/main.go b/cmd/server/main.go index a564341..c711969 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -28,6 +28,7 @@ func main() { fmt.Printf("BuildTime: %s \n", BuildTime) os.Exit(0) } + defer g.Flush() p := cracker.NewHttpProxy(*addr, *secret, *https) if *https { f, err := os.Stat(*cert)