Created
August 22, 2023 00:55
-
-
Save voluntas/c6d395ddfde71d3c94efd2adfdf5e3a3 to your computer and use it in GitHub Desktop.
HTTP/2 over TCP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"github.com/labstack/echo/v4" | |
"golang.org/x/net/http2" | |
"golang.org/x/net/http2/h2c" | |
) | |
func main() { | |
e := echo.New() | |
h2s := &http2.Server{} | |
e.Server = &http.Server{ | |
Addr: ":5555", | |
Handler: h2c.NewHandler(e, h2s), | |
} | |
e.GET(".ok", func(c echo.Context) error { | |
return c.String(200, "ok") | |
}) | |
e.Server.ListenAndServe() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://echo.labstack.com/docs/start-server#http2-cleartext-server-http2-over-http ドキュメントがあった orz