|
|
@ -16,7 +16,8 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
type Config struct {
|
|
|
|
version bool
|
|
|
|
version bool
|
|
|
|
|
|
|
|
certPath string
|
|
|
|
|
|
|
|
|
|
|
|
addr string
|
|
|
|
addr string
|
|
|
|
webAddr string
|
|
|
|
webAddr string
|
|
|
@ -38,6 +39,7 @@ func loadConfig() *Config {
|
|
|
|
flag.StringVar(&config.dump, "dump", "", "dump filename")
|
|
|
|
flag.StringVar(&config.dump, "dump", "", "dump filename")
|
|
|
|
flag.IntVar(&config.dumpLevel, "dump_level", 0, "dump level: 0 - header, 1 - header + body")
|
|
|
|
flag.IntVar(&config.dumpLevel, "dump_level", 0, "dump level: 0 - header, 1 - header + body")
|
|
|
|
flag.StringVar(&config.mapperDir, "mapper_dir", "", "mapper files dirpath")
|
|
|
|
flag.StringVar(&config.mapperDir, "mapper_dir", "", "mapper files dirpath")
|
|
|
|
|
|
|
|
flag.StringVar(&config.certPath, "cert_path", "", "path of generate cert files")
|
|
|
|
flag.Parse()
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
|
|
|
|
return config
|
|
|
|
return config
|
|
|
@ -61,6 +63,7 @@ func main() {
|
|
|
|
Addr: config.addr,
|
|
|
|
Addr: config.addr,
|
|
|
|
StreamLargeBodies: 1024 * 1024 * 5,
|
|
|
|
StreamLargeBodies: 1024 * 1024 * 5,
|
|
|
|
SslInsecure: config.ssl_insecure,
|
|
|
|
SslInsecure: config.ssl_insecure,
|
|
|
|
|
|
|
|
CaRootPath: config.certPath,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
p, err := proxy.NewProxy(opts)
|
|
|
|
p, err := proxy.NewProxy(opts)
|
|
|
|