|
|
@ -19,6 +19,7 @@ type Config struct {
|
|
|
|
|
|
|
|
|
|
|
|
addr string
|
|
|
|
addr string
|
|
|
|
webAddr string
|
|
|
|
webAddr string
|
|
|
|
|
|
|
|
ssl_insecure bool
|
|
|
|
|
|
|
|
|
|
|
|
dump string // dump filename
|
|
|
|
dump string // dump filename
|
|
|
|
dumpLevel int // dump level
|
|
|
|
dumpLevel int // dump level
|
|
|
@ -32,6 +33,7 @@ func loadConfig() *Config {
|
|
|
|
flag.BoolVar(&config.version, "version", false, "show version")
|
|
|
|
flag.BoolVar(&config.version, "version", false, "show version")
|
|
|
|
flag.StringVar(&config.addr, "addr", ":9080", "proxy listen addr")
|
|
|
|
flag.StringVar(&config.addr, "addr", ":9080", "proxy listen addr")
|
|
|
|
flag.StringVar(&config.webAddr, "web_addr", ":9081", "web interface listen addr")
|
|
|
|
flag.StringVar(&config.webAddr, "web_addr", ":9081", "web interface listen addr")
|
|
|
|
|
|
|
|
flag.BoolVar(&config.ssl_insecure, "ssl_insecure", false, "not verify upstream server SSL/TLS certificates.")
|
|
|
|
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")
|
|
|
@ -60,6 +62,7 @@ func main() {
|
|
|
|
opts := &proxy.Options{
|
|
|
|
opts := &proxy.Options{
|
|
|
|
Addr: config.addr,
|
|
|
|
Addr: config.addr,
|
|
|
|
StreamLargeBodies: 1024 * 1024 * 5,
|
|
|
|
StreamLargeBodies: 1024 * 1024 * 5,
|
|
|
|
|
|
|
|
SslInsecure: config.ssl_insecure,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
p, err := proxy.NewProxy(opts)
|
|
|
|
p, err := proxy.NewProxy(opts)
|
|
|
|