mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 11:06:27 +01:00
add running with http/3 quic protocol as server listener to examples, rel to: https://github.com/kataras/iris/issues/1295
Former-commit-id: 4c970c8143a663e5b879c8aeb6614504432dfe8d
This commit is contained in:
parent
29deac3270
commit
82d645e3cb
|
@ -87,6 +87,7 @@ Structuring depends on your own needs. We can't tell you how to design your own
|
||||||
* [common net.Listener](http-listening/custom-listener/main.go)
|
* [common net.Listener](http-listening/custom-listener/main.go)
|
||||||
* [SO_REUSEPORT for unix systems](http-listening/custom-listener/unix-reuseport/main.go)
|
* [SO_REUSEPORT for unix systems](http-listening/custom-listener/unix-reuseport/main.go)
|
||||||
- Custom HTTP Server
|
- Custom HTTP Server
|
||||||
|
* [HTTP/3 Quic](http-listening/http3-quic) **NEW**
|
||||||
* [easy way](http-listening/custom-httpserver/easy-way/main.go)
|
* [easy way](http-listening/custom-httpserver/easy-way/main.go)
|
||||||
* [std way](http-listening/custom-httpserver/std-way/main.go)
|
* [std way](http-listening/custom-httpserver/std-way/main.go)
|
||||||
* [multi server instances](http-listening/custom-httpserver/multi/main.go)
|
* [multi server instances](http-listening/custom-httpserver/multi/main.go)
|
||||||
|
|
|
@ -45,7 +45,8 @@ Iris 是个底层框架, 对 MVC 模式有很好的支持,但不限制文件
|
||||||
- 自定义 TCP 监听器
|
- 自定义 TCP 监听器
|
||||||
* [通用 net.Listener](http-listening/custom-listener/main.go)
|
* [通用 net.Listener](http-listening/custom-listener/main.go)
|
||||||
* [unix系统的SO_REUSEPORT](http-listening/custom-listener/unix-reuseport/main.go)
|
* [unix系统的SO_REUSEPORT](http-listening/custom-listener/unix-reuseport/main.go)
|
||||||
- 自定义 HTTP 服务
|
- 自定义 HTTP 服务
|
||||||
|
* [HTTP/3 Quic](http-listening/http3-quic) **凊**
|
||||||
* [简单方式](http-listening/custom-httpserver/easy-way/main.go)
|
* [简单方式](http-listening/custom-httpserver/easy-way/main.go)
|
||||||
* [标准方式](http-listening/custom-httpserver/std-way/main.go)
|
* [标准方式](http-listening/custom-httpserver/std-way/main.go)
|
||||||
* [多个服务示例](http-listening/custom-httpserver/multi/main.go)
|
* [多个服务示例](http-listening/custom-httpserver/multi/main.go)
|
||||||
|
|
18
_examples/http-listening/http3-quic/localhost.cert
Normal file
18
_examples/http-listening/http3-quic/localhost.cert
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIC+zCCAeOgAwIBAgIJAI5gi8BzcdQgMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV
|
||||||
|
BAMMCWxvY2FsaG9zdDAeFw0xOTA3MDkxMjExNDBaFw0yOTA3MDYxMjExNDBaMBQx
|
||||||
|
EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||||
|
ggEBAM1eSGwoYznwYtt+/hrv9o4FYxJFlxIMX6WN3c2y3rr8uOwExkz2RuU9SzgF
|
||||||
|
qn0ctP1DoIKWNO0/L5j5Bjy2do0k8wHYPbTqb9zG64NGZj1lhkHgYXWyCD9U41DX
|
||||||
|
V1DiJ2JiCRBadowFRRf3/KIPf3xnrCBSCoQwdfIeJJtAF9El2/TnTrGq9N98FJqR
|
||||||
|
dCNyi+zY/iuymcA3aDOyYNjxSiuV//7ONEql5dxvRlhkjCHgrQ/rIbH/lSFAS+NG
|
||||||
|
H/6ksEBX2+Q1LlQBaFiGeEnjVpCymrRfADw7bKyqMav39Nndw4UZ1r5MSG20YtXM
|
||||||
|
dE4lA6VfAKzIZs2n87WF7OO8Y2sCAwEAAaNQME4wHQYDVR0OBBYEFKYItamcYz4Z
|
||||||
|
NiDy3I2zflU4A7ywMB8GA1UdIwQYMBaAFKYItamcYz4ZNiDy3I2zflU4A7ywMAwG
|
||||||
|
A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBACSoSrEArlgPJ1ftlSMkThUR
|
||||||
|
atTqJ/yB0rSyRxsct0C04qX880VP7avnKc0UhaDruXRjdAVn4X8KI+j6azQSKT40
|
||||||
|
KRSVBinnonE0D4DBMCUVDFtkBW3FZJXAYyIYdF/6J3Khn/ksm7VDcVxYI1rjg87B
|
||||||
|
U6aJytOkoGA2WGQOB1L0HtnTsarg/SKP/LSDUFT+XK6zTE7uogAUrpbwlpIaxc+8
|
||||||
|
3jXvgxEdPj9Rq9Nt8/zjCkCGB2EusPPnqxcbqZb5WcGPCIlg3ChKq7vpaQld6KqG
|
||||||
|
70jT7BZ2fqWSVJ5szRoS8WpKy1SZEx/+AA7VojMzkkw4RLb66zr1v7029b51ol4=
|
||||||
|
-----END CERTIFICATE-----
|
27
_examples/http-listening/http3-quic/localhost.key
Normal file
27
_examples/http-listening/http3-quic/localhost.key
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpAIBAAKCAQEAzV5IbChjOfBi237+Gu/2jgVjEkWXEgxfpY3dzbLeuvy47ATG
|
||||||
|
TPZG5T1LOAWqfRy0/UOggpY07T8vmPkGPLZ2jSTzAdg9tOpv3Mbrg0ZmPWWGQeBh
|
||||||
|
dbIIP1TjUNdXUOInYmIJEFp2jAVFF/f8og9/fGesIFIKhDB18h4km0AX0SXb9OdO
|
||||||
|
sar033wUmpF0I3KL7Nj+K7KZwDdoM7Jg2PFKK5X//s40SqXl3G9GWGSMIeCtD+sh
|
||||||
|
sf+VIUBL40Yf/qSwQFfb5DUuVAFoWIZ4SeNWkLKatF8APDtsrKoxq/f02d3DhRnW
|
||||||
|
vkxIbbRi1cx0TiUDpV8ArMhmzafztYXs47xjawIDAQABAoIBADvaKok7DBAquuT1
|
||||||
|
keEP5m9lqoX8uhaMfKOnQOleJAOi+9HtYk2zyN2ui2l8XT+xSh41w2XLmQk7zQds
|
||||||
|
LCEtnEduaVQ0TWeYm5lgb+sGbW2fVQ2F82F1zWmHt+grmkr8XjYSFEor0zjjoEtn
|
||||||
|
/rzMf38mR8fzoRT9eqJ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|
BtV7F8KpLruWohxXWy4QZ6HsAO255gIJ8DCbEAFCj96EHNx8KADSm3qbslu2fIB0
|
||||||
|
zCsVaETGNAjV/d5hAEdYmgynCY49gNXV55ehV1UqzFoEfZVM9j5hUg==
|
||||||
|
-----END RSA PRIVATE KEY-----
|
26
_examples/http-listening/http3-quic/main.go
Normal file
26
_examples/http-listening/http3-quic/main.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/kataras/iris"
|
||||||
|
|
||||||
|
"github.com/lucas-clemente/quic-go/http3"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
$ go get -u github.com/lucas-clemente/quic-go/...
|
||||||
|
*/
|
||||||
|
func main() {
|
||||||
|
app := iris.New()
|
||||||
|
|
||||||
|
app.Get("/", func(ctx iris.Context) {
|
||||||
|
ctx.Writef("Hello from Index")
|
||||||
|
})
|
||||||
|
|
||||||
|
// app.Configure(iris.WithOptimizations, or any other core config here)
|
||||||
|
// app.Build()
|
||||||
|
// http3.ListenAndServe(":443", "./localhost.cert", "./localhost.key", app)
|
||||||
|
// OR:
|
||||||
|
app.Run(iris.Raw(func() error {
|
||||||
|
return http3.ListenAndServe(":443", "./localhost.cert", "./localhost.key", app)
|
||||||
|
}))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user