Skip to content

Commit 7b7c3ed

Browse files
authored
quic: upgrade quic-go to v0.53 (libp2p#3323)
1 parent 000582c commit 7b7c3ed

File tree

16 files changed

+147
-158
lines changed

16 files changed

+147
-158
lines changed

go.mod

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ require (
5353
github.com/pion/webrtc/v4 v4.1.2
5454
github.com/prometheus/client_golang v1.22.0
5555
github.com/prometheus/client_model v0.6.2
56-
github.com/quic-go/quic-go v0.52.0
57-
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66
56+
github.com/quic-go/quic-go v0.53.0
57+
github.com/quic-go/webtransport-go v0.9.0
5858
github.com/stretchr/testify v1.10.0
5959
go.uber.org/fx v1.24.0
6060
go.uber.org/goleak v1.3.0
@@ -73,8 +73,6 @@ require (
7373
github.com/cespare/xxhash/v2 v2.3.0 // indirect
7474
github.com/davecgh/go-spew v1.1.1 // indirect
7575
github.com/francoispqt/gojay v1.2.13 // indirect
76-
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
77-
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a // indirect
7876
github.com/google/uuid v1.6.0 // indirect
7977
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
8078
github.com/mattn/go-isatty v0.0.20 // indirect
@@ -83,7 +81,6 @@ require (
8381
github.com/minio/sha256-simd v1.0.1 // indirect
8482
github.com/multiformats/go-base36 v0.2.0 // indirect
8583
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
86-
github.com/onsi/ginkgo/v2 v2.23.4 // indirect
8784
github.com/pion/dtls/v2 v2.2.12 // indirect
8885
github.com/pion/dtls/v3 v3.0.6 // indirect
8986
github.com/pion/interceptor v0.1.40 // indirect
@@ -103,7 +100,6 @@ require (
103100
github.com/quic-go/qpack v0.5.1 // indirect
104101
github.com/spaolacci/murmur3 v1.1.0 // indirect
105102
github.com/wlynxg/anet v0.0.5 // indirect
106-
go.uber.org/automaxprocs v1.6.0 // indirect
107103
go.uber.org/dig v1.19.0 // indirect
108104
go.uber.org/multierr v1.11.0 // indirect
109105
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect

go.sum

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
3939
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
4040
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
4141
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
42-
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
43-
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
44-
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
45-
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
4642
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
4743
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
4844
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
@@ -60,8 +56,6 @@ github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF
6056
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
6157
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
6258
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
63-
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a h1://KbezygeMJZCSHH+HgUZiTeSoiuFspbMg1ge+eFj18=
64-
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
6559
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
6660
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
6761
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
@@ -178,10 +172,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
178172
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
179173
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
180174
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
181-
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
182-
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
183-
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
184-
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
185175
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
186176
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
187177
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
@@ -230,8 +220,6 @@ github.com/pion/webrtc/v4 v4.1.2/go.mod h1:xsCXiNAmMEjIdFxAYU0MbB3RwRieJsegSB2JZ
230220
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
231221
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
232222
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
233-
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
234-
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
235223
github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
236224
github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q=
237225
github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0=
@@ -246,10 +234,10 @@ github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzM
246234
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
247235
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
248236
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
249-
github.com/quic-go/quic-go v0.52.0 h1:/SlHrCRElyaU6MaEPKqKr9z83sBg2v4FLLvWM+Z47pA=
250-
github.com/quic-go/quic-go v0.52.0/go.mod h1:MFlGGpcpJqRAfmYi6NC2cptDPSxRWTOGNuP4wqrWmzQ=
251-
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 h1:4WFk6u3sOT6pLa1kQ50ZVdm8BQFgJNA117cepZxtLIg=
252-
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66/go.mod h1:Vp72IJajgeOL6ddqrAhmp7IM9zbTcgkQxD/YdxrVwMw=
237+
github.com/quic-go/quic-go v0.53.0 h1:QHX46sISpG2S03dPeZBgVIZp8dGagIaiu2FiVYvpCZI=
238+
github.com/quic-go/quic-go v0.53.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
239+
github.com/quic-go/webtransport-go v0.9.0 h1:jgys+7/wm6JarGDrW+lD/r9BGqBAmqY/ssklE09bA70=
240+
github.com/quic-go/webtransport-go v0.9.0/go.mod h1:4FUYIiUc75XSsF6HShcLeXXYZJ9AGwo/xh3L8M/P1ao=
253241
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
254242
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
255243
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
@@ -298,8 +286,6 @@ github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
298286
github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
299287
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
300288
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
301-
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
302-
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
303289
go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4=
304290
go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE=
305291
go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg=

p2p/transport/quic/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
type conn struct {
16-
quicConn quic.Connection
16+
quicConn *quic.Conn
1717
transport *transport
1818
scope network.ConnManagementScope
1919

p2p/transport/quic/listener.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (l *listener) Accept() (tpt.CapableConn, error) {
8383
// wrapConn wraps a QUIC connection into a libp2p [tpt.CapableConn].
8484
// If wrapping fails. The caller is responsible for cleaning up the
8585
// connection.
86-
func (l *listener) wrapConn(qconn quic.Connection) (*conn, error) {
86+
func (l *listener) wrapConn(qconn *quic.Conn) (*conn, error) {
8787
remoteMultiaddr, err := quicreuse.ToQuicMultiaddr(qconn.RemoteAddr(), qconn.ConnectionState().Version)
8888
if err != nil {
8989
return nil, err
@@ -112,7 +112,7 @@ func (l *listener) wrapConn(qconn quic.Connection) (*conn, error) {
112112
return c, nil
113113
}
114114

115-
func (l *listener) wrapConnWithScope(qconn quic.Connection, connScope network.ConnManagementScope, remoteMultiaddr ma.Multiaddr) (*conn, error) {
115+
func (l *listener) wrapConnWithScope(qconn *quic.Conn, connScope network.ConnManagementScope, remoteMultiaddr ma.Multiaddr) (*conn, error) {
116116
// The tls.Config used to establish this connection already verified the certificate chain.
117117
// Since we don't have any way of knowing which tls.Config was used though,
118118
// we have to re-determine the peer's identity here.

p2p/transport/quic/stream.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const (
1414
)
1515

1616
type stream struct {
17-
quic.Stream
17+
*quic.Stream
1818
}
1919

20-
var _ network.MuxedStream = &stream{}
20+
var _ network.MuxedStream = stream{}
2121

2222
func parseStreamError(err error) error {
2323
if err == nil {
@@ -54,38 +54,38 @@ func parseStreamError(err error) error {
5454
return err
5555
}
5656

57-
func (s *stream) Read(b []byte) (n int, err error) {
57+
func (s stream) Read(b []byte) (n int, err error) {
5858
n, err = s.Stream.Read(b)
5959
return n, parseStreamError(err)
6060
}
6161

62-
func (s *stream) Write(b []byte) (n int, err error) {
62+
func (s stream) Write(b []byte) (n int, err error) {
6363
n, err = s.Stream.Write(b)
6464
return n, parseStreamError(err)
6565
}
6666

67-
func (s *stream) Reset() error {
67+
func (s stream) Reset() error {
6868
s.Stream.CancelRead(reset)
6969
s.Stream.CancelWrite(reset)
7070
return nil
7171
}
7272

73-
func (s *stream) ResetWithError(errCode network.StreamErrorCode) error {
73+
func (s stream) ResetWithError(errCode network.StreamErrorCode) error {
7474
s.Stream.CancelRead(quic.StreamErrorCode(errCode))
7575
s.Stream.CancelWrite(quic.StreamErrorCode(errCode))
7676
return nil
7777
}
7878

79-
func (s *stream) Close() error {
79+
func (s stream) Close() error {
8080
s.Stream.CancelRead(reset)
8181
return s.Stream.Close()
8282
}
8383

84-
func (s *stream) CloseRead() error {
84+
func (s stream) CloseRead() error {
8585
s.Stream.CancelRead(reset)
8686
return nil
8787
}
8888

89-
func (s *stream) CloseWrite() error {
89+
func (s stream) CloseWrite() error {
9090
return s.Stream.Close()
9191
}

p2p/transport/quic/transport.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type transport struct {
5050
rnd rand.Rand
5151

5252
connMx sync.Mutex
53-
conns map[quic.Connection]*conn
53+
conns map[*quic.Conn]*conn
5454

5555
listenersMu sync.Mutex
5656
// map of UDPAddr as string to a virtualListeners
@@ -95,7 +95,7 @@ func NewTransport(key ic.PrivKey, connManager *quicreuse.ConnManager, psk pnet.P
9595
connManager: connManager,
9696
gater: gater,
9797
rcmgr: rcmgr,
98-
conns: make(map[quic.Connection]*conn),
98+
conns: make(map[*quic.Conn]*conn),
9999
holePunching: make(map[holePunchKey]*activeHolePunch),
100100
rnd: *rand.New(rand.NewSource(time.Now().UnixNano())),
101101

@@ -174,13 +174,13 @@ func (t *transport) dialWithScope(ctx context.Context, raddr ma.Multiaddr, p pee
174174
return c, nil
175175
}
176176

177-
func (t *transport) addConn(conn quic.Connection, c *conn) {
177+
func (t *transport) addConn(conn *quic.Conn, c *conn) {
178178
t.connMx.Lock()
179179
t.conns[conn] = c
180180
t.connMx.Unlock()
181181
}
182182

183-
func (t *transport) removeConn(conn quic.Connection) {
183+
func (t *transport) removeConn(conn *quic.Conn) {
184184
t.connMx.Lock()
185185
delete(t.conns, conn)
186186
t.connMx.Unlock()
@@ -344,7 +344,7 @@ func (t *transport) Listen(addr ma.Multiaddr) (tpt.Listener, error) {
344344
return l, nil
345345
}
346346

347-
func (t *transport) allowWindowIncrease(conn quic.Connection, size uint64) bool {
347+
func (t *transport) allowWindowIncrease(conn *quic.Conn, size uint64) bool {
348348
// If the QUIC connection tries to increase the window before we've inserted it
349349
// into our connections map (which we do right after dialing / accepting it),
350350
// we have no way to account for that memory. This should be very rare.

p2p/transport/quicreuse/connmgr.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
type QUICListener interface {
27-
Accept(ctx context.Context) (quic.Connection, error)
27+
Accept(ctx context.Context) (*quic.Conn, error)
2828
Close() error
2929
Addr() net.Addr
3030
}
@@ -33,7 +33,7 @@ var _ QUICListener = &quic.Listener{}
3333

3434
type QUICTransport interface {
3535
Listen(tlsConf *tls.Config, conf *quic.Config) (QUICListener, error)
36-
Dial(ctx context.Context, addr net.Addr, tlsConf *tls.Config, conf *quic.Config) (quic.Connection, error)
36+
Dial(ctx context.Context, addr net.Addr, tlsConf *tls.Config, conf *quic.Config) (*quic.Conn, error)
3737
WriteTo(b []byte, addr net.Addr) (int, error)
3838
ReadNonQUICPacket(ctx context.Context, b []byte) (int, net.Addr, error)
3939
io.Closer
@@ -198,7 +198,7 @@ func (c *ConnManager) LendTransport(network string, tr QUICTransport, conn net.P
198198

199199
// ListenQUIC listens for quic connections with the provided `tlsConf.NextProtos` ALPNs on `addr`. The same addr can be shared between
200200
// different ALPNs.
201-
func (c *ConnManager) ListenQUIC(addr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool) (Listener, error) {
201+
func (c *ConnManager) ListenQUIC(addr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn *quic.Conn, delta uint64) bool) (Listener, error) {
202202
return c.ListenQUICAndAssociate(nil, addr, tlsConf, allowWindowIncrease)
203203
}
204204

@@ -208,7 +208,7 @@ func (c *ConnManager) ListenQUIC(addr ma.Multiaddr, tlsConf *tls.Config, allowWi
208208
// or `DialQUIC` calls with the same `association` will reuse the QUIC Transport used by this method.
209209
// A common use of associations is to ensure /quic dials use the quic listening address and /webtransport dials use the
210210
// WebTransport listening address.
211-
func (c *ConnManager) ListenQUICAndAssociate(association any, addr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool) (Listener, error) {
211+
func (c *ConnManager) ListenQUICAndAssociate(association any, addr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn *quic.Conn, delta uint64) bool) (Listener, error) {
212212
netw, host, err := manet.DialArgs(addr)
213213
if err != nil {
214214
return nil, err
@@ -332,7 +332,7 @@ func WithAssociation(ctx context.Context, association any) context.Context {
332332
// - Any other listening transport
333333
// - Any transport previously used for dialing
334334
// If none of these are available, it'll create a new transport.
335-
func (c *ConnManager) DialQUIC(ctx context.Context, raddr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool) (quic.Connection, error) {
335+
func (c *ConnManager) DialQUIC(ctx context.Context, raddr ma.Multiaddr, tlsConf *tls.Config, allowWindowIncrease func(conn *quic.Conn, delta uint64) bool) (*quic.Conn, error) {
336336
naddr, v, err := FromQuicMultiaddr(raddr)
337337
if err != nil {
338338
return nil, err

p2p/transport/quicreuse/connmgr_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func TestExternalTransport(t *testing.T) {
295295
"quic",
296296
ma.StringCast(fmt.Sprintf("/ip4/0.0.0.0/udp/%d", port)),
297297
&tls.Config{NextProtos: []string{"libp2p"}},
298-
func(quic.Connection, uint64) bool { return false },
298+
func(*quic.Conn, uint64) bool { return false },
299299
)
300300
require.NoError(t, err)
301301
defer ln.Close()
@@ -316,7 +316,7 @@ func TestExternalTransport(t *testing.T) {
316316
ctx,
317317
ma.StringCast(fmt.Sprintf("/ip4/127.0.0.1/udp/%d/quic-v1", udpLn.LocalAddr().(*net.UDPAddr).Port)),
318318
&tls.Config{NextProtos: []string{"libp2p"}},
319-
func(quic.Connection, uint64) bool { return false },
319+
func(*quic.Conn, uint64) bool { return false },
320320
)
321321
require.ErrorIs(t, err, context.DeadlineExceeded)
322322

p2p/transport/quicreuse/listener.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
type Listener interface {
20-
Accept(context.Context) (quic.Connection, error)
20+
Accept(context.Context) (*quic.Conn, error)
2121
Addr() net.Addr
2222
Multiaddrs() []ma.Multiaddr
2323
io.Closer
@@ -26,7 +26,7 @@ type Listener interface {
2626
type protoConf struct {
2727
ln *listener
2828
tlsConf *tls.Config
29-
allowWindowIncrease func(conn quic.Connection, delta uint64) bool
29+
allowWindowIncrease func(conn *quic.Conn, delta uint64) bool
3030
}
3131

3232
type quicListener struct {
@@ -80,7 +80,7 @@ func newQuicListener(tr RefCountedQUICTransport, quicConfig *quic.Config) (*quic
8080
return cl, nil
8181
}
8282

83-
func (l *quicListener) allowWindowIncrease(conn quic.Connection, delta uint64) bool {
83+
func (l *quicListener) allowWindowIncrease(conn *quic.Conn, delta uint64) bool {
8484
l.protocolsMu.Lock()
8585
defer l.protocolsMu.Unlock()
8686

@@ -91,7 +91,7 @@ func (l *quicListener) allowWindowIncrease(conn quic.Connection, delta uint64) b
9191
return conf.allowWindowIncrease(conn, delta)
9292
}
9393

94-
func (l *quicListener) Add(tlsConf *tls.Config, allowWindowIncrease func(conn quic.Connection, delta uint64) bool, onRemove func()) (Listener, error) {
94+
func (l *quicListener) Add(tlsConf *tls.Config, allowWindowIncrease func(conn *quic.Conn, delta uint64) bool, onRemove func()) (Listener, error) {
9595
l.protocolsMu.Lock()
9696
defer l.protocolsMu.Unlock()
9797

@@ -157,7 +157,7 @@ const queueLen = 16
157157

158158
// A listener for a single ALPN protocol (set).
159159
type listener struct {
160-
queue chan quic.Connection
160+
queue chan *quic.Conn
161161
acceptLoopRunning chan struct{}
162162
addr net.Addr
163163
addrs []ma.Multiaddr
@@ -169,23 +169,23 @@ var _ Listener = &listener{}
169169

170170
func newSingleListener(addr net.Addr, addrs []ma.Multiaddr, remove func(), running chan struct{}) *listener {
171171
return &listener{
172-
queue: make(chan quic.Connection, queueLen),
172+
queue: make(chan *quic.Conn, queueLen),
173173
acceptLoopRunning: running,
174174
remove: remove,
175175
addr: addr,
176176
addrs: addrs,
177177
}
178178
}
179179

180-
func (l *listener) add(c quic.Connection) {
180+
func (l *listener) add(c *quic.Conn) {
181181
select {
182182
case l.queue <- c:
183183
default:
184184
c.CloseWithError(1, "queue full")
185185
}
186186
}
187187

188-
func (l *listener) Accept(ctx context.Context) (quic.Connection, error) {
188+
func (l *listener) Accept(ctx context.Context) (*quic.Conn, error) {
189189
select {
190190
case <-ctx.Done():
191191
return nil, ctx.Err()

p2p/transport/quicreuse/reuse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type RefCountedQUICTransport interface {
2525
DecreaseCount()
2626
IncreaseCount()
2727

28-
Dial(ctx context.Context, addr net.Addr, tlsConf *tls.Config, conf *quic.Config) (quic.Connection, error)
28+
Dial(ctx context.Context, addr net.Addr, tlsConf *tls.Config, conf *quic.Config) (*quic.Conn, error)
2929
Listen(tlsConf *tls.Config, conf *quic.Config) (QUICListener, error)
3030
}
3131

@@ -45,7 +45,7 @@ func (c *singleOwnerTransport) LocalAddr() net.Addr {
4545
return c.packetConn.LocalAddr()
4646
}
4747

48-
func (c *singleOwnerTransport) Dial(ctx context.Context, addr net.Addr, tlsConf *tls.Config, conf *quic.Config) (quic.Connection, error) {
48+
func (c *singleOwnerTransport) Dial(ctx context.Context, addr net.Addr, tlsConf *tls.Config, conf *quic.Config) (*quic.Conn, error) {
4949
return c.Transport.Dial(ctx, addr, tlsConf, conf)
5050
}
5151

0 commit comments

Comments
 (0)