Open herugen opened 3 years ago
Hello @TheWayYouMakeMeFeel,
Iris is a very modular framework, you can even run it under http/3 quic or, as in your case, follow the example to enable http/2 without TLS and keep support http/1.1:
package main
import (
"net/http"
"github.com/kataras/iris/v12"
"golang.org/x/net/http2"
)
// $ go get golang.org/x/net/http2
// # Take a look at the golang.org/x/net/http2/h2c package as well,
// # you may want to use it.
// $ go run main.go
// $ brew install curl-openssl
// # Add curl-openssl to the front of your path.
// Test with the following commands:
// $ curl -v --http2 http://localhost:8080
// $ curl -v --http1.1 http://localhost:8080
func main() {
// Initialize Iris Application.
app := iris.New()
// Build the API.
app.Any("/", index)
// Finally, listen and serve on port 8080 using h2c.
app.Run(iris.Raw(func() error {
host := app.NewHost(&http.Server{
Addr: ":8080",
})
err := http2.ConfigureServer(host.Server, &http2.Server{
MaxConcurrentStreams: 250,
PermitProhibitedCipherSuites: true,
})
if err != nil {
return err
}
return host.ListenAndServe()
}))
}
func index(ctx iris.Context) {
ctx.WriteString("Hello, World!\n")
}
Is your feature request related to a problem? Please describe. iris can just serve as a http/1.1 or http2 with TLS server
Describe the solution you'd like serve as http2 server without TLS
Describe alternatives you've considered none
Additional context To speed up or just debug http2 clearttext for 5G Service Based Interface.