add disable-http2 option

This commit is contained in:
Vladislav Yarmak 2021-02-26 09:35:17 +02:00
parent 91586e727f
commit 202eb1da9c
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,7 @@ type CLIArgs struct {
cert, key, cafile string cert, key, cafile string
list_ciphers bool list_ciphers bool
ciphers string ciphers string
disableHTTP2 bool
} }
func list_ciphers() { func list_ciphers() {
@ -50,6 +51,7 @@ func parse_args() CLIArgs {
flag.StringVar(&args.cafile, "cafile", "", "CA file to authenticate clients with certificates") flag.StringVar(&args.cafile, "cafile", "", "CA file to authenticate clients with certificates")
flag.BoolVar(&args.list_ciphers, "list-ciphers", false, "list ciphersuites") flag.BoolVar(&args.list_ciphers, "list-ciphers", false, "list ciphersuites")
flag.StringVar(&args.ciphers, "ciphers", "", "colon-separated list of enabled ciphers") flag.StringVar(&args.ciphers, "ciphers", "", "colon-separated list of enabled ciphers")
flag.BoolVar(&args.disableHTTP2, "disable-http2", false, "disable HTTP2")
flag.Parse() flag.Parse()
return args return args
} }
@ -88,6 +90,10 @@ func run() int {
IdleTimeout: 0, IdleTimeout: 0,
} }
if args.disableHTTP2 {
server.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
}
mainLogger.Info("Starting proxy server...") mainLogger.Info("Starting proxy server...")
if args.cert != "" { if args.cert != "" {
cfg, err1 := makeServerTLSConfig(args.cert, args.key, args.cafile) cfg, err1 := makeServerTLSConfig(args.cert, args.key, args.cafile)