mirror of
https://github.com/mmatczuk/go-http-tunnel.git
synced 2026-05-15 14:16:17 -06:00
cmd: server HTTP/2 support
This commit is contained in:
parent
d50d6aac06
commit
d05233bdb0
1 changed files with 11 additions and 7 deletions
|
|
@ -7,6 +7,8 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
|
||||
"github.com/google/gops/agent"
|
||||
"github.com/mmatczuk/go-http-tunnel"
|
||||
"github.com/mmatczuk/go-http-tunnel/cmd/cmd"
|
||||
|
|
@ -75,10 +77,8 @@ func main() {
|
|||
"action", "start http",
|
||||
"addr", opts.httpAddr,
|
||||
)
|
||||
err := http.ListenAndServe(opts.httpAddr, server)
|
||||
if err != nil {
|
||||
fatal("failed to start HTTP: %s", err)
|
||||
}
|
||||
|
||||
fatal("failed to start HTTP: %s", http.ListenAndServe(opts.httpAddr, server))
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
@ -90,10 +90,14 @@ func main() {
|
|||
"action", "start https",
|
||||
"addr", opts.httpsAddr,
|
||||
)
|
||||
err := http.ListenAndServeTLS(opts.httpsAddr, opts.tlsCrt, opts.tlsKey, server)
|
||||
if err != nil {
|
||||
fatal("failed to start HTTPS: %s", err)
|
||||
|
||||
s := &http.Server{
|
||||
Addr: opts.httpsAddr,
|
||||
Handler: server,
|
||||
}
|
||||
http2.ConfigureServer(s, nil)
|
||||
|
||||
fatal("failed to start HTTPS: %s", s.ListenAndServeTLS(opts.tlsCrt, opts.tlsKey))
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue