5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 08:45:39 +00:00

Don't use 0-RTT for QUIC

This commit is contained in:
Neil Alexander 2023-11-26 16:19:00 +00:00
parent 0d676c6a3b
commit 39c4b24395
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -24,7 +24,7 @@ type linkQUICStream struct {
} }
type linkQUICListener struct { type linkQUICListener struct {
*quic.EarlyListener *quic.Listener
ch <-chan *linkQUICStream ch <-chan *linkQUICStream
} }
@ -50,11 +50,11 @@ func (l *links) newLinkQUIC() *linkQUIC {
} }
func (l *linkQUIC) dial(ctx context.Context, url *url.URL, info linkInfo, options linkOptions) (net.Conn, error) { func (l *linkQUIC) dial(ctx context.Context, url *url.URL, info linkInfo, options linkOptions) (net.Conn, error) {
qc, err := quic.DialAddrEarly(ctx, url.Host, l.tlsconfig, l.quicconfig) qc, err := quic.DialAddr(ctx, url.Host, l.tlsconfig, l.quicconfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }
qs, err := qc.OpenStream() qs, err := qc.OpenStreamSync(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -65,14 +65,14 @@ func (l *linkQUIC) dial(ctx context.Context, url *url.URL, info linkInfo, option
} }
func (l *linkQUIC) listen(ctx context.Context, url *url.URL, _ string) (net.Listener, error) { func (l *linkQUIC) listen(ctx context.Context, url *url.URL, _ string) (net.Listener, error) {
ql, err := quic.ListenAddrEarly(url.Host, l.tlsconfig, l.quicconfig) ql, err := quic.ListenAddr(url.Host, l.tlsconfig, l.quicconfig)
if err != nil { if err != nil {
return nil, err return nil, err
} }
ch := make(chan *linkQUICStream) ch := make(chan *linkQUICStream)
lql := &linkQUICListener{ lql := &linkQUICListener{
EarlyListener: ql, Listener: ql,
ch: ch, ch: ch,
} }
go func() { go func() {
for { for {