gin icon indicating copy to clipboard operation
gin copied to clipboard

experimental: support http3

Open thinkerou opened this issue 1 year ago • 14 comments

but, quic-go supports the min go version is 1.19 and remove go1.15 for compiling successful

thinkerou avatar Jun 26 '22 12:06 thinkerou

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (eac2daa) 98.63% compared to head (c4ea442) 98.06%. Report is 37 commits behind head on master.

:exclamation: Current head c4ea442 differs from pull request most recent head 6af53ae. Consider uploading reports for the commit 6af53ae to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3210      +/-   ##
==========================================
- Coverage   98.63%   98.06%   -0.57%     
==========================================
  Files          42       43       +1     
  Lines        3151     3157       +6     
==========================================
- Hits         3108     3096      -12     
- Misses         29       48      +19     
+ Partials       14       13       -1     
Flag Coverage Δ
?
go-1.16 98.03% <100.00%> (?)
go-1.17 97.97% <100.00%> (?)
go-1.18 97.97% <100.00%> (-0.57%) :arrow_down:
go-1.19 ?
go-1.20 ?
macos-latest 98.06% <100.00%> (-0.57%) :arrow_down:
nomsgpack 98.03% <100.00%> (?)
ubuntu-latest 98.06% <100.00%> (-0.57%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 26 '22 12:06 codecov[bot]

don't use http3.ListenAndServeQUIC example

h3s := http3.Server{
			Addr:       addr,
			Handler:    router.Handler(),
			TLSConfig:  util1.GTls,
			QuicConfig: &quic.Config{},
		}
		if err := h3s.ListenAndServe(); nil != err {
			log.Println("HTTP/3.0 ListenAndServe ", err)
		} else {
			log.Printf("HTTP/3.0  Listening and serving HTTPS on %s\n", addr)
		}

Util1.GTls will be obtained from the dynamic ca server challenge

hktalent avatar Dec 30 '22 03:12 hktalent

ping @thinkerou

appleboy avatar Jan 01 '23 06:01 appleboy

New repo: https://github.com/quic-go/quic-go

appleboy avatar Apr 26 '23 02:04 appleboy

@thinkerou Can you keep working on this PR?

appleboy avatar Apr 26 '23 03:04 appleboy

@thinkerou Can you keep working on this PR?

updated, but have unit test error:

=== RUN   TestRunQUIC
2023/04/26 07:24:50 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Receive-Buffer-Size for details.
    gin_integration_test.go:43: 
        	Error Trace:	/home/runner/work/gin/gin/gin_integration_test.go:43
        	            				/home/runner/work/gin/gin/gin_integration_1.19_test.go:30
        	Error:      	Received unexpected error:
        	            	Get "https://localhost:8443/example": dial tcp [::1]:8443: connect: connection refused
        	Test:       	TestRunQUIC
--- FAIL: TestRunQUIC (0.01s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0xa8aae2]

goroutine 193 [running]:
testing.tRunner.func1.2({0xb4a9e0, 0x11b7ea0})
	/opt/hostedtoolcache/go/1.19.8/x64/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.19.8/x64/src/testing/testing.go:1399 +0x39f
panic({0xb4a9e0, 0x11b7ea0})
	/opt/hostedtoolcache/go/1.19.8/x64/src/runtime/panic.go:884 +0x212
github.com/gin-gonic/gin.testRequest(0xc0004af520, {0xc0000c9f50, 0x1, 0xc00040a050?})
	/home/runner/work/gin/gin/gin_integration_test.go:44 +0x182
github.com/gin-gonic/gin.TestRunQUIC(0xc0004af520)
	/home/runner/work/gin/gin/gin_integration_1.19_test.go:30 +0x108
testing.tRunner(0xc0004af520, 0xc6df88)
	/opt/hostedtoolcache/go/1.19.8/x64/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
	/opt/hostedtoolcache/go/1.19.8/x64/src/testing/testing.go:1493 +0x35f
FAIL	github.com/gin-gonic/gin	0.084s
FAIL

https://github.com/gin-gonic/gin/actions/runs/4806024121/jobs/8553052446?pr=3210

thinkerou avatar Apr 26 '23 11:04 thinkerou

@thinkerou is there a running version for current stable and an example?

mcules avatar Aug 21 '23 11:08 mcules

https://endoflife.date/go

1.19 support Ended 2 weeks ago

raphaelauv avatar Aug 24 '23 15:08 raphaelauv

Waiting for https://github.com/golang/go/issues/58547 QUIC implementation

appleboy avatar Jan 05 '24 14:01 appleboy

failed to sufficiently increase receive buffer size

This error is anticipated and isn't blocking. Here is the info about it from Cloudflared where it has been used in production for a number of years:

https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes https://github.com/cloudflare/cloudflared/issues/522#issuecomment-1018787568

Duly noted on Golang official implementation, adding in the info here though for reference. Will subscribe to the tracking issue and lend a hand when the time is right.

maggie44 avatar Feb 08 '24 10:02 maggie44

And here with a fixed test example: https://github.com/maggie44/gin/commit/790cfe2ed2e4e94a778d88973fe1414f64b7a779

maggie44 avatar Feb 08 '24 11:02 maggie44

but, quic-go supports the min go version is 1.19 and remove go1.15 for compiling successful

Since mid 2023, quic-go is using crypto/tls (since crypto/tls gained QUIC support in Go 1.20), and we don't impose any limitations on Go versions anymore. This PR should probably be updated to use a more recent quic-go version.

marten-seemann avatar Feb 14 '24 01:02 marten-seemann