mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00
chore: update quic-go to v0.50.0 (#3204)
This commit is contained in:
2
go.mod
2
go.mod
@@ -55,7 +55,7 @@ require (
|
||||
github.com/pion/webrtc/v4 v4.0.9
|
||||
github.com/prometheus/client_golang v1.20.5
|
||||
github.com/prometheus/client_model v0.6.1
|
||||
github.com/quic-go/quic-go v0.49.0
|
||||
github.com/quic-go/quic-go v0.50.0
|
||||
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66
|
||||
github.com/raulk/go-watchdog v1.3.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
|
4
go.sum
4
go.sum
@@ -330,8 +330,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||
github.com/quic-go/quic-go v0.49.0 h1:w5iJHXwHxs1QxyBv1EHKuC50GX5to8mJAxvtnttJp94=
|
||||
github.com/quic-go/quic-go v0.49.0/go.mod h1:s2wDnmCdooUQBmQfpUSTCYBl1/D4FcqbULMMkASvR6s=
|
||||
github.com/quic-go/quic-go v0.50.0 h1:3H/ld1pa3CYhkcc20TPIyG1bNsdhn9qZBGN3b9/UyUo=
|
||||
github.com/quic-go/quic-go v0.50.0/go.mod h1:Vim6OmUvlYdwBhXP9ZVrtGmCMWa3wEqhq3NgYrI8b4E=
|
||||
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 h1:4WFk6u3sOT6pLa1kQ50ZVdm8BQFgJNA117cepZxtLIg=
|
||||
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66/go.mod h1:Vp72IJajgeOL6ddqrAhmp7IM9zbTcgkQxD/YdxrVwMw=
|
||||
github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk=
|
||||
|
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
mrand "math/rand"
|
||||
"net"
|
||||
@@ -564,6 +563,13 @@ func TestStatelessReset(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func newUDPConnLocalhost(t testing.TB, port int) (*net.UDPConn, func()) {
|
||||
t.Helper()
|
||||
conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: port})
|
||||
require.NoError(t, err)
|
||||
return conn, func() { conn.Close() }
|
||||
}
|
||||
|
||||
func testStatelessReset(t *testing.T, tc *connTestCase) {
|
||||
serverID, serverKey := createPeer(t)
|
||||
_, clientKey := createPeer(t)
|
||||
@@ -575,12 +581,14 @@ func testStatelessReset(t *testing.T, tc *connTestCase) {
|
||||
|
||||
var drop uint32
|
||||
dropCallback := func(quicproxy.Direction, []byte) bool { return atomic.LoadUint32(&drop) > 0 }
|
||||
proxy, err := quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
|
||||
RemoteAddr: fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
|
||||
proxyConn, cleanup := newUDPConnLocalhost(t, 0)
|
||||
proxy := quicproxy.Proxy{
|
||||
Conn: proxyConn,
|
||||
ServerAddr: ln.Addr().(*net.UDPAddr),
|
||||
DropPacket: dropCallback,
|
||||
})
|
||||
}
|
||||
err = proxy.Start()
|
||||
require.NoError(t, err)
|
||||
proxyLocalAddr := proxy.LocalAddr()
|
||||
|
||||
// establish a connection
|
||||
clientTransport, err := NewTransport(clientKey, newConnManager(t, tc.Options...), nil, nil, nil)
|
||||
@@ -612,7 +620,9 @@ func testStatelessReset(t *testing.T, tc *connTestCase) {
|
||||
atomic.StoreUint32(&drop, 1)
|
||||
ln.Close()
|
||||
(<-connChan).Close()
|
||||
proxyLocalPort := proxy.LocalAddr().(*net.UDPAddr).Port
|
||||
proxy.Close()
|
||||
cleanup()
|
||||
|
||||
// Start another listener (on a different port).
|
||||
ln, err = serverTransport.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1"))
|
||||
@@ -621,13 +631,17 @@ func testStatelessReset(t *testing.T, tc *connTestCase) {
|
||||
// Now that the new server is up, re-enable packet forwarding.
|
||||
atomic.StoreUint32(&drop, 0)
|
||||
|
||||
proxyConn, cleanup = newUDPConnLocalhost(t, proxyLocalPort)
|
||||
defer cleanup()
|
||||
// Recreate the proxy, such that its client-facing port stays constant.
|
||||
proxy, err = quicproxy.NewQuicProxy(proxyLocalAddr.String(), &quicproxy.Opts{
|
||||
RemoteAddr: fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
|
||||
proxyBis := quicproxy.Proxy{
|
||||
Conn: proxyConn,
|
||||
ServerAddr: ln.Addr().(*net.UDPAddr),
|
||||
DropPacket: dropCallback,
|
||||
})
|
||||
}
|
||||
err = proxyBis.Start()
|
||||
require.NoError(t, err)
|
||||
defer proxy.Close()
|
||||
defer proxyBis.Close()
|
||||
|
||||
// Trigger something (not too small) to be sent, so that we receive the stateless reset.
|
||||
// The new server doesn't have any state for the previously established connection.
|
||||
|
@@ -776,6 +776,14 @@ func TestTransportWebRTC_PeerConnectionDTLSFailed(t *testing.T) {
|
||||
require.Nil(t, conn)
|
||||
}
|
||||
|
||||
func newUDPConnLocalhost(t testing.TB) *net.UDPConn {
|
||||
t.Helper()
|
||||
conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0})
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { conn.Close() })
|
||||
return conn
|
||||
}
|
||||
|
||||
func TestConnectionTimeoutOnListener(t *testing.T) {
|
||||
tr, listeningPeer := getTransport(t)
|
||||
tr.peerConnectionTimeouts.Disconnect = 100 * time.Millisecond
|
||||
@@ -788,11 +796,12 @@ func TestConnectionTimeoutOnListener(t *testing.T) {
|
||||
defer ln.Close()
|
||||
|
||||
var drop atomic.Bool
|
||||
proxy, err := quicproxy.NewQuicProxy("127.0.0.1:0", &quicproxy.Opts{
|
||||
RemoteAddr: fmt.Sprintf("127.0.0.1:%d", ln.Addr().(*net.UDPAddr).Port),
|
||||
proxy := quicproxy.Proxy{
|
||||
Conn: newUDPConnLocalhost(t),
|
||||
ServerAddr: ln.Addr().(*net.UDPAddr),
|
||||
DropPacket: func(quicproxy.Direction, []byte) bool { return drop.Load() },
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
require.NoError(t, proxy.Start())
|
||||
defer proxy.Close()
|
||||
|
||||
tr1, connectingPeer := getTransport(t)
|
||||
|
@@ -540,6 +540,14 @@ func (s *reportingScope) ReserveMemory(size int, _ uint8) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func newUDPConnLocalhost(t testing.TB) *net.UDPConn {
|
||||
t.Helper()
|
||||
conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0})
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { conn.Close() })
|
||||
return conn
|
||||
}
|
||||
|
||||
func TestFlowControlWindowIncrease(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("this test is flaky on Windows")
|
||||
@@ -573,11 +581,12 @@ func TestFlowControlWindowIncrease(t *testing.T) {
|
||||
str.CloseWrite()
|
||||
}()
|
||||
|
||||
proxy, err := quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
|
||||
RemoteAddr: ln.Addr().String(),
|
||||
proxy := quicproxy.Proxy{
|
||||
Conn: newUDPConnLocalhost(t),
|
||||
ServerAddr: ln.Addr().(*net.UDPAddr),
|
||||
DelayPacket: func(quicproxy.Direction, []byte) time.Duration { return rtt / 2 },
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
require.NoError(t, proxy.Start())
|
||||
defer proxy.Close()
|
||||
|
||||
_, clientKey := newIdentity(t)
|
||||
@@ -590,7 +599,7 @@ func TestFlowControlWindowIncrease(t *testing.T) {
|
||||
var addr ma.Multiaddr
|
||||
for _, comp := range ma.Split(ln.Multiaddr()) {
|
||||
if _, err := comp.ValueForProtocol(ma.P_UDP); err == nil {
|
||||
addr = addr.Encapsulate(ma.StringCast(fmt.Sprintf("/udp/%d", proxy.LocalPort())))
|
||||
addr = addr.Encapsulate(ma.StringCast(fmt.Sprintf("/udp/%d", proxy.LocalAddr().(*net.UDPAddr).Port)))
|
||||
continue
|
||||
}
|
||||
if addr == nil {
|
||||
|
@@ -88,7 +88,7 @@ require (
|
||||
github.com/prometheus/common v0.62.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.49.0 // indirect
|
||||
github.com/quic-go/quic-go v0.50.0 // indirect
|
||||
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 // indirect
|
||||
github.com/raulk/go-watchdog v1.3.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
|
@@ -276,8 +276,8 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||
github.com/quic-go/quic-go v0.49.0 h1:w5iJHXwHxs1QxyBv1EHKuC50GX5to8mJAxvtnttJp94=
|
||||
github.com/quic-go/quic-go v0.49.0/go.mod h1:s2wDnmCdooUQBmQfpUSTCYBl1/D4FcqbULMMkASvR6s=
|
||||
github.com/quic-go/quic-go v0.50.0 h1:3H/ld1pa3CYhkcc20TPIyG1bNsdhn9qZBGN3b9/UyUo=
|
||||
github.com/quic-go/quic-go v0.50.0/go.mod h1:Vim6OmUvlYdwBhXP9ZVrtGmCMWa3wEqhq3NgYrI8b4E=
|
||||
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66 h1:4WFk6u3sOT6pLa1kQ50ZVdm8BQFgJNA117cepZxtLIg=
|
||||
github.com/quic-go/webtransport-go v0.8.1-0.20241018022711-4ac2c9250e66/go.mod h1:Vp72IJajgeOL6ddqrAhmp7IM9zbTcgkQxD/YdxrVwMw=
|
||||
github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk=
|
||||
|
Reference in New Issue
Block a user