upgrade version

addon-dailer
lqqyt2423 3 years ago
parent 0848dd8a28
commit b883408664

@ -15,8 +15,6 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
const version = "0.1.4"
type Config struct { type Config struct {
version bool version bool
@ -48,11 +46,6 @@ func loadConfig() *Config {
func main() { func main() {
config := loadConfig() config := loadConfig()
if config.version {
fmt.Println("go-mitmproxy: " + version)
os.Exit(0)
}
// for debug // for debug
// slog.SetFlags(slog.LstdFlags | slog.Lshortfile) // slog.SetFlags(slog.LstdFlags | slog.Lshortfile)
// log.SetReportCaller(true) // log.SetReportCaller(true)
@ -64,8 +57,6 @@ func main() {
FullTimestamp: true, FullTimestamp: true,
}) })
log.Infof("go-mitmproxy version %v\n", version)
opts := &proxy.Options{ opts := &proxy.Options{
Addr: config.addr, Addr: config.addr,
StreamLargeBodies: 1024 * 1024 * 5, StreamLargeBodies: 1024 * 1024 * 5,
@ -77,6 +68,13 @@ func main() {
log.Fatal(err) 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(&addon.Log{})
p.AddAddon(web.NewWebAddon(config.webAddr)) p.AddAddon(web.NewWebAddon(config.webAddr))

@ -22,6 +22,7 @@ type Options struct {
} }
type Proxy struct { type Proxy struct {
Version string
Server *http.Server Server *http.Server
Client *http.Client Client *http.Client
Interceptor Interceptor Interceptor Interceptor
@ -31,6 +32,7 @@ type Proxy struct {
func NewProxy(opts *Options) (*Proxy, error) { func NewProxy(opts *Options) (*Proxy, error) {
proxy := new(Proxy) proxy := new(Proxy)
proxy.Version = "0.1.5"
proxy.Server = &http.Server{ proxy.Server = &http.Server{
Addr: opts.Addr, Addr: opts.Addr,

Loading…
Cancel
Save