From b883408664a65d2c56e085b6b9a4ceef52c1124b Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Thu, 20 Jan 2022 13:15:00 +0800 Subject: [PATCH] upgrade version --- cmd/go-mitmproxy/main.go | 16 +++++++--------- proxy/proxy.go | 2 ++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/go-mitmproxy/main.go b/cmd/go-mitmproxy/main.go index de2621d..7dfdd6a 100644 --- a/cmd/go-mitmproxy/main.go +++ b/cmd/go-mitmproxy/main.go @@ -15,8 +15,6 @@ import ( log "github.com/sirupsen/logrus" ) -const version = "0.1.4" - type Config struct { version bool @@ -48,11 +46,6 @@ func loadConfig() *Config { func main() { config := loadConfig() - if config.version { - fmt.Println("go-mitmproxy: " + version) - os.Exit(0) - } - // for debug // slog.SetFlags(slog.LstdFlags | slog.Lshortfile) // log.SetReportCaller(true) @@ -64,8 +57,6 @@ func main() { FullTimestamp: true, }) - log.Infof("go-mitmproxy version %v\n", version) - opts := &proxy.Options{ Addr: config.addr, StreamLargeBodies: 1024 * 1024 * 5, @@ -77,6 +68,13 @@ func main() { log.Fatal(err) } + if config.version { + fmt.Println("go-mitmproxy: " + p.Version) + os.Exit(0) + } + + log.Infof("go-mitmproxy version %v\n", p.Version) + p.AddAddon(&addon.Log{}) p.AddAddon(web.NewWebAddon(config.webAddr)) diff --git a/proxy/proxy.go b/proxy/proxy.go index 881e2f0..5d66941 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -22,6 +22,7 @@ type Options struct { } type Proxy struct { + Version string Server *http.Server Client *http.Client Interceptor Interceptor @@ -31,6 +32,7 @@ type Proxy struct { func NewProxy(opts *Options) (*Proxy, error) { proxy := new(Proxy) + proxy.Version = "0.1.5" proxy.Server = &http.Server{ Addr: opts.Addr,