Skip to content

Commit

Permalink
update quic-go to v0.42.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Mar 23, 2024
1 parent 4f3d108 commit 2a78f5c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
9 changes: 8 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package webtransport

import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
Expand Down Expand Up @@ -76,7 +77,7 @@ func (d *Dialer) init() {
return true
}
if d.QuicConfig == nil {
d.QuicConfig = &quic.Config{}
d.QuicConfig = &quic.Config{EnableDatagrams: true}
}
if d.QuicConfig.MaxIncomingStreams == 0 {
d.QuicConfig.MaxIncomingStreams = 100
Expand All @@ -86,6 +87,12 @@ func (d *Dialer) init() {
func (d *Dialer) Dial(ctx context.Context, urlStr string, reqHdr http.Header) (*http.Response, *Session, error) {
d.initOnce.Do(func() { d.init() })

// Technically, this is not true. DATAGRAMs could be sent using the Capsule protocol.
// However, quic-go currently enforces QUIC datagram support if HTTP/3 datagrams are enabled.
if !d.QuicConfig.EnableDatagrams {
return nil, nil, errors.New("WebTransport requires DATAGRAM support, enable it via QuicConfig.EnableDatagrams")
}

u, err := url.Parse(urlStr)
if err != nil {
return nil, nil, err
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/quic-go/webtransport-go
go 1.21

require (
github.com/quic-go/quic-go v0.41.0
github.com/quic-go/quic-go v0.42.0
github.com/stretchr/testify v1.8.0
go.uber.org/mock v0.3.0
go.uber.org/mock v0.4.0
)

require (
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7q
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.41.0 h1:aD8MmHfgqTURWNJy48IYFg2OnxwHT3JL7ahGs73lb4k=
github.com/quic-go/quic-go v0.41.0/go.mod h1:qCkNjqczPEvgsOnxZ0eCD14lv+B2LHlFAB++CNOh9hA=
github.com/quic-go/quic-go v0.42.0 h1:uSfdap0eveIl8KXnipv9K7nlwZ5IqLlYOpJ58u5utpM=
github.com/quic-go/quic-go v0.42.0/go.mod h1:132kz4kL3F9vxhW3CtQJLDVwcFe5wdWeJXXijhsO57M=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
Expand Down Expand Up @@ -134,8 +134,8 @@ github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cb
github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo=
go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down Expand Up @@ -183,6 +183,8 @@ golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s *Server) init() error {

// configure the http3.Server
if s.H3.AdditionalSettings == nil {
s.H3.AdditionalSettings = make(map[uint64]uint64)
s.H3.AdditionalSettings = make(map[uint64]uint64, 1)
}
s.H3.AdditionalSettings[settingsEnableWebtransport] = 1
s.H3.EnableDatagrams = true
Expand Down
8 changes: 4 additions & 4 deletions webtransport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func establishSession(t *testing.T, handler func(*webtransport.Session)) (sess *
s := &webtransport.Server{
H3: http3.Server{
TLSConfig: tlsConf,
QuicConfig: &quic.Config{Tracer: getQlogger(t)},
QuicConfig: &quic.Config{Tracer: getQlogger(t), EnableDatagrams: true},
},
}
addHandler(t, s, handler)
Expand All @@ -80,7 +80,7 @@ func establishSession(t *testing.T, handler func(*webtransport.Session)) (sess *
d := webtransport.Dialer{
RoundTripper: &http3.RoundTripper{
TLSClientConfig: &tls.Config{RootCAs: certPool},
QuicConfig: &quic.Config{Tracer: getQlogger(t)},
QuicConfig: &quic.Config{Tracer: getQlogger(t), EnableDatagrams: true},
},
}
defer d.Close()
Expand Down Expand Up @@ -344,7 +344,7 @@ func TestMultipleClients(t *testing.T) {
d := webtransport.Dialer{
RoundTripper: &http3.RoundTripper{
TLSClientConfig: &tls.Config{RootCAs: certPool},
QuicConfig: &quic.Config{Tracer: getQlogger(t)},
QuicConfig: &quic.Config{Tracer: getQlogger(t), EnableDatagrams: true},
},
}
defer d.Close()
Expand Down Expand Up @@ -524,7 +524,7 @@ func TestCheckOrigin(t *testing.T) {
d := webtransport.Dialer{
RoundTripper: &http3.RoundTripper{
TLSClientConfig: &tls.Config{RootCAs: certPool},
QuicConfig: &quic.Config{Tracer: getQlogger(t)},
QuicConfig: &quic.Config{Tracer: getQlogger(t), EnableDatagrams: true},
},
}
defer d.Close()
Expand Down

0 comments on commit 2a78f5c

Please sign in to comment.