From e25fbc1e92343f3a402893fd4d31790f3104c202 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Fri, 11 Aug 2023 15:01:44 -0700 Subject: [PATCH] Replace all \d/quic with \d/quic-v1 --- defaults.go | 2 -- examples/libp2p-host/README.md | 2 +- libp2p_test.go | 6 ++--- p2p/host/autorelay/addrsplosion_test.go | 16 ++++++------ p2p/net/swarm/dial_ranker_test.go | 26 +++++++++---------- p2p/net/swarm/dial_worker_test.go | 10 +++---- p2p/net/swarm/swarm_addr_test.go | 2 +- p2p/net/swarm/swarm_dial_test.go | 6 ++--- p2p/net/swarm/swarm_metrics_test.go | 2 +- p2p/net/swarm/swarm_test.go | 2 +- p2p/net/swarm/testing/testing.go | 2 +- p2p/net/swarm/util_test.go | 2 +- .../holepunch/metrics_noalloc_test.go | 4 +-- p2p/protocol/holepunch/metrics_test.go | 4 +-- p2p/protocol/identify/obsaddr_glass_test.go | 6 ++--- p2p/test/quic/quic_test.go | 6 ++--- p2p/transport/quic/conn_test.go | 4 +-- p2p/transport/quic/listener_test.go | 10 +++---- p2p/transport/quic/transport_test.go | 6 ++--- p2p/transport/quicreuse/connmgr_test.go | 2 +- .../quicreuse/quic_multiaddr_test.go | 4 +-- test-plans/cmd/ping/main.go | 2 +- 22 files changed, 62 insertions(+), 64 deletions(-) diff --git a/defaults.go b/defaults.go index c0ed6698a1..d11302690c 100644 --- a/defaults.go +++ b/defaults.go @@ -79,11 +79,9 @@ var RandomIdentity = func(cfg *Config) error { var DefaultListenAddrs = func(cfg *Config) error { addrs := []string{ "/ip4/0.0.0.0/tcp/0", - "/ip4/0.0.0.0/udp/0/quic", "/ip4/0.0.0.0/udp/0/quic-v1", "/ip4/0.0.0.0/udp/0/quic-v1/webtransport", "/ip6/::/tcp/0", - "/ip6/::/udp/0/quic", "/ip6/::/udp/0/quic-v1", "/ip6/::/udp/0/quic-v1/webtransport", } diff --git a/examples/libp2p-host/README.md b/examples/libp2p-host/README.md index e187f067cf..7d4321f33c 100644 --- a/examples/libp2p-host/README.md +++ b/examples/libp2p-host/README.md @@ -47,7 +47,7 @@ h2, err := libp2p.New( // Multiple listen addresses libp2p.ListenAddrStrings( "/ip4/0.0.0.0/tcp/9000", // regular tcp connections - "/ip4/0.0.0.0/udp/9000/quic", // a UDP endpoint for the QUIC transport + "/ip4/0.0.0.0/udp/9000/quic-v1", // a UDP endpoint for the QUIC transport ), // support TLS connections libp2p.Security(libp2ptls.ID, libp2ptls.New), diff --git a/libp2p_test.go b/libp2p_test.go index 7d947afb82..72a9246025 100644 --- a/libp2p_test.go +++ b/libp2p_test.go @@ -99,7 +99,7 @@ func TestAutoNATService(t *testing.T) { func TestDefaultListenAddrs(t *testing.T) { reTCP := regexp.MustCompile("/(ip)[4|6]/((0.0.0.0)|(::))/tcp/") - reQUIC := regexp.MustCompile("/(ip)[4|6]/((0.0.0.0)|(::))/udp/([0-9]*)/quic") + reQUIC := regexp.MustCompile("/(ip)[4|6]/((0.0.0.0)|(::))/udp/([0-9]*)/quic-v1") reCircuit := regexp.MustCompile("/p2p-circuit") // Test 1: Setting the correct listen addresses if userDefined.Transport == nil && userDefined.ListenAddrs == nil @@ -180,7 +180,7 @@ func TestTransportConstructorTCP(t *testing.T) { require.NoError(t, err) defer h.Close() require.NoError(t, h.Network().Listen(ma.StringCast("/ip4/127.0.0.1/tcp/0"))) - err = h.Network().Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic")) + err = h.Network().Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1")) require.Error(t, err) require.Contains(t, err.Error(), swarm.ErrNoTransport.Error()) } @@ -192,7 +192,7 @@ func TestTransportConstructorQUIC(t *testing.T) { ) require.NoError(t, err) defer h.Close() - require.NoError(t, h.Network().Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic"))) + require.NoError(t, h.Network().Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-1"))) err = h.Network().Listen(ma.StringCast("/ip4/127.0.0.1/tcp/0")) require.Error(t, err) require.Contains(t, err.Error(), swarm.ErrNoTransport.Error()) diff --git a/p2p/host/autorelay/addrsplosion_test.go b/p2p/host/autorelay/addrsplosion_test.go index 0d8a57d9d9..1bbd910c54 100644 --- a/p2p/host/autorelay/addrsplosion_test.go +++ b/p2p/host/autorelay/addrsplosion_test.go @@ -11,14 +11,14 @@ func TestCleanupAddrs(t *testing.T) { t.Run("with no addrplosion", func(t *testing.T) { addrs := makeAddrList( "/ip4/127.0.0.1/tcp/4001", - "/ip4/127.0.0.1/udp/4002/quic", + "/ip4/127.0.0.1/udp/4002/quic-v1", "/ip4/1.2.3.4/tcp/4001", - "/ip4/1.2.3.4/udp/4002/quic", + "/ip4/1.2.3.4/udp/4002/quic-v1", "/dnsaddr/somedomain.com/tcp/4002/ws", ) clean := makeAddrList( "/ip4/1.2.3.4/tcp/4001", - "/ip4/1.2.3.4/udp/4002/quic", + "/ip4/1.2.3.4/udp/4002/quic-v1", "/dnsaddr/somedomain.com/tcp/4002/ws", ) require.ElementsMatch(t, clean, cleanupAddressSet(addrs), "cleaned up set doesn't match expected") @@ -32,11 +32,11 @@ func TestCleanupAddrs(t *testing.T) { "/ip4/1.2.3.4/tcp/33333", "/ip4/1.2.3.4/tcp/33334", "/ip4/1.2.3.4/tcp/33335", - "/ip4/1.2.3.4/udp/4002/quic", + "/ip4/1.2.3.4/udp/4002/quic-v1", ) clean := makeAddrList( "/ip4/1.2.3.4/tcp/4001", - "/ip4/1.2.3.4/udp/4002/quic", + "/ip4/1.2.3.4/udp/4002/quic-v1", ) require.ElementsMatch(t, clean, cleanupAddressSet(addrs), "cleaned up set doesn't match expected") }) @@ -48,11 +48,11 @@ func TestCleanupAddrs(t *testing.T) { "/ip4/1.2.3.4/tcp/33333", "/ip4/1.2.3.4/tcp/33334", "/ip4/1.2.3.4/tcp/33335", - "/ip4/1.2.3.4/udp/4002/quic", + "/ip4/1.2.3.4/udp/4002/quic-v1", ) clean := makeAddrList( "/ip4/1.2.3.4/tcp/4001", - "/ip4/1.2.3.4/udp/4002/quic", + "/ip4/1.2.3.4/udp/4002/quic-v1", ) require.ElementsMatch(t, clean, cleanupAddressSet(addrs), "cleaned up set doesn't match expected") }) @@ -75,7 +75,7 @@ func TestCleanupAddrs(t *testing.T) { // test with a squeaky clean address set addrs := makeAddrList( "/ip4/1.2.3.4/tcp/4001", - "/ip4/1.2.3.4/udp/4001/quic", + "/ip4/1.2.3.4/udp/4001/quic-v1", ) require.ElementsMatch(t, addrs, cleanupAddressSet(addrs), "cleaned up set doesn't match expected") }) diff --git a/p2p/net/swarm/dial_ranker_test.go b/p2p/net/swarm/dial_ranker_test.go index 60fbfabbfb..635eded829 100644 --- a/p2p/net/swarm/dial_ranker_test.go +++ b/p2p/net/swarm/dial_ranker_test.go @@ -20,14 +20,14 @@ func sortAddrDelays(addrDelays []network.AddrDelay) { } func TestNoDelayDialRanker(t *testing.T) { - q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") + q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") q1v1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") wt1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1/webtransport/") - q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic") + q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") q2v1 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") - q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic") + q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1") q3v1 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1") - q4 := ma.StringCast("/ip4/1.2.3.4/udp/4/quic") + q4 := ma.StringCast("/ip4/1.2.3.4/udp/4/quic-v1") t1 := ma.StringCast("/ip4/1.2.3.5/tcp/1/") testCase := []struct { @@ -70,14 +70,14 @@ func TestNoDelayDialRanker(t *testing.T) { } func TestDelayRankerQUICDelay(t *testing.T) { - q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") + q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") q1v1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") wt1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1/webtransport/") - q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic") + q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") q2v1 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") - q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic") + q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1") q3v1 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1") - q4 := ma.StringCast("/ip4/1.2.3.4/udp/4/quic") + q4 := ma.StringCast("/ip4/1.2.3.4/udp/4/quic-v1") q1v16 := ma.StringCast("/ip6/1::2/udp/1/quic-v1") q2v16 := ma.StringCast("/ip6/1::2/udp/2/quic-v1") @@ -164,11 +164,11 @@ func TestDelayRankerQUICDelay(t *testing.T) { } func TestDelayRankerTCPDelay(t *testing.T) { - q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") + q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") q1v1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") - q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic") + q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") q2v1 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") - q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic") + q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1") q1v16 := ma.StringCast("/ip6/1::2/udp/1/quic-v1") q2v16 := ma.StringCast("/ip6/1::2/udp/2/quic-v1") @@ -238,8 +238,8 @@ func TestDelayRankerTCPDelay(t *testing.T) { } func TestDelayRankerRelay(t *testing.T) { - q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") - q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic") + q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") + q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") pid := test.RandPeerIDFatal(t) r1 := ma.StringCast(fmt.Sprintf("/ip4/1.2.3.4/tcp/1/p2p-circuit/p2p/%s", pid)) diff --git a/p2p/net/swarm/dial_worker_test.go b/p2p/net/swarm/dial_worker_test.go index 89130eeeb2..6679bd9587 100644 --- a/p2p/net/swarm/dial_worker_test.go +++ b/p2p/net/swarm/dial_worker_test.go @@ -61,7 +61,7 @@ func makeSwarm(t *testing.T) *Swarm { t.Fatal(err) } - if err := s.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic")); err != nil { + if err := s.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1")); err != nil { t.Fatal(err) } @@ -234,7 +234,7 @@ func TestDialWorkerLoopFailure(t *testing.T) { _, p2 := newPeer(t) - s1.Peerstore().AddAddrs(p2, []ma.Multiaddr{ma.StringCast("/ip4/11.0.0.1/tcp/1234"), ma.StringCast("/ip4/11.0.0.1/udp/1234/quic")}, peerstore.PermanentAddrTTL) + s1.Peerstore().AddAddrs(p2, []ma.Multiaddr{ma.StringCast("/ip4/11.0.0.1/tcp/1234"), ma.StringCast("/ip4/11.0.0.1/udp/1234/quic-v1")}, peerstore.PermanentAddrTTL) reqch := make(chan dialRequest) resch := make(chan dialResponse) @@ -259,7 +259,7 @@ func TestDialWorkerLoopConcurrentFailure(t *testing.T) { _, p2 := newPeer(t) - s1.Peerstore().AddAddrs(p2, []ma.Multiaddr{ma.StringCast("/ip4/11.0.0.1/tcp/1234"), ma.StringCast("/ip4/11.0.0.1/udp/1234/quic")}, peerstore.PermanentAddrTTL) + s1.Peerstore().AddAddrs(p2, []ma.Multiaddr{ma.StringCast("/ip4/11.0.0.1/tcp/1234"), ma.StringCast("/ip4/11.0.0.1/udp/1234/quic-v1")}, peerstore.PermanentAddrTTL) reqch := make(chan dialRequest) worker := newDialWorker(s1, p2, reqch, nil) @@ -307,7 +307,7 @@ func TestDialWorkerLoopConcurrentMix(t *testing.T) { defer s2.Close() s1.Peerstore().AddAddrs(s2.LocalPeer(), s2.ListenAddresses(), peerstore.PermanentAddrTTL) - s1.Peerstore().AddAddrs(s2.LocalPeer(), []ma.Multiaddr{ma.StringCast("/ip4/11.0.0.1/tcp/1234"), ma.StringCast("/ip4/11.0.0.1/udp/1234/quic")}, peerstore.PermanentAddrTTL) + s1.Peerstore().AddAddrs(s2.LocalPeer(), []ma.Multiaddr{ma.StringCast("/ip4/11.0.0.1/tcp/1234"), ma.StringCast("/ip4/11.0.0.1/udp/1234/quic-v1")}, peerstore.PermanentAddrTTL) reqch := make(chan dialRequest) worker := newDialWorker(s1, s2.LocalPeer(), reqch, nil) @@ -917,7 +917,7 @@ func TestDialWorkerLoopQuicOverTCP(t *testing.T) { tc := schedulingTestCase{ input: []timedDial{ { - addr: ma.StringCast("/ip4/127.0.0.1/udp/20000/quic"), + addr: ma.StringCast("/ip4/127.0.0.1/udp/20000/quic-v1"), delay: 0, success: true, }, diff --git a/p2p/net/swarm/swarm_addr_test.go b/p2p/net/swarm/swarm_addr_test.go index 6cb4f96ae1..2eda0f5d28 100644 --- a/p2p/net/swarm/swarm_addr_test.go +++ b/p2p/net/swarm/swarm_addr_test.go @@ -100,7 +100,7 @@ func TestDialAddressSelection(t *testing.T) { require.NoError(t, s.AddTransport(circuitTr)) require.Equal(t, tcpTr, s.TransportForDialing(ma.StringCast("/ip4/127.0.0.1/tcp/1234"))) - require.Equal(t, quicTr, s.TransportForDialing(ma.StringCast("/ip4/127.0.0.1/udp/1234/quic"))) + require.Equal(t, quicTr, s.TransportForDialing(ma.StringCast("/ip4/127.0.0.1/udp/1234/quic-v1"))) require.Equal(t, circuitTr, s.TransportForDialing(ma.StringCast(fmt.Sprintf("/ip4/127.0.0.1/udp/1234/quic/p2p-circuit/p2p/%s", id)))) require.Equal(t, webtransportTr, s.TransportForDialing(ma.StringCast(fmt.Sprintf("/ip4/127.0.0.1/udp/1234/quic-v1/webtransport/certhash/%s", certHash)))) require.Nil(t, s.TransportForDialing(ma.StringCast("/ip4/1.2.3.4"))) diff --git a/p2p/net/swarm/swarm_dial_test.go b/p2p/net/swarm/swarm_dial_test.go index 2f6b3f8c4d..9538ae731d 100644 --- a/p2p/net/swarm/swarm_dial_test.go +++ b/p2p/net/swarm/swarm_dial_test.go @@ -263,15 +263,15 @@ func TestAddrResolutionRecursive(t *testing.T) { } func TestAddrsForDialFiltering(t *testing.T) { - q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") + q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") q1v1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") wt1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1/webtransport/") - q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic") + q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") q2v1 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") wt2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1/webtransport/") - q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic") + q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1") t1 := ma.StringCast("/ip4/1.2.3.4/tcp/1") ws1 := ma.StringCast("/ip4/1.2.3.4/tcp/1/ws") diff --git a/p2p/net/swarm/swarm_metrics_test.go b/p2p/net/swarm/swarm_metrics_test.go index 25e13f3213..261942f395 100644 --- a/p2p/net/swarm/swarm_metrics_test.go +++ b/p2p/net/swarm/swarm_metrics_test.go @@ -29,7 +29,7 @@ func BenchmarkMetricsConnOpen(b *testing.B) { } _, pub, err := crypto.GenerateEd25519Key(rand.Reader) require.NoError(b, err) - quicAddr := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") + quicAddr := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") tcpAddr := ma.StringCast("/ip4/1.2.3.4/tcp/1/") tr := NewMetricsTracer() for i := 0; i < b.N; i++ { diff --git a/p2p/net/swarm/swarm_test.go b/p2p/net/swarm/swarm_test.go index 2385545ad1..c795b68afb 100644 --- a/p2p/net/swarm/swarm_test.go +++ b/p2p/net/swarm/swarm_test.go @@ -390,7 +390,7 @@ func TestTypedNilConn(t *testing.T) { func TestPreventDialListenAddr(t *testing.T) { s := GenSwarm(t, OptDialOnly) - if err := s.Listen(ma.StringCast("/ip4/0.0.0.0/udp/0/quic")); err != nil { + if err := s.Listen(ma.StringCast("/ip4/0.0.0.0/udp/0/quic-v1")); err != nil { t.Fatal(err) } addrs, err := s.InterfaceListenAddresses() diff --git a/p2p/net/swarm/testing/testing.go b/p2p/net/swarm/testing/testing.go index b052a993ad..071a828b54 100644 --- a/p2p/net/swarm/testing/testing.go +++ b/p2p/net/swarm/testing/testing.go @@ -187,7 +187,7 @@ func GenSwarm(t *testing.T, opts ...Option) *swarm.Swarm { t.Fatal(err) } if !cfg.dialOnly { - if err := s.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic")); err != nil { + if err := s.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1")); err != nil { t.Fatal(err) } } diff --git a/p2p/net/swarm/util_test.go b/p2p/net/swarm/util_test.go index 66246b554e..ab9baa7ed2 100644 --- a/p2p/net/swarm/util_test.go +++ b/p2p/net/swarm/util_test.go @@ -20,7 +20,7 @@ func TestIsFdConsuming(t *testing.T) { isFdConsuming: true, }, "quic": { - addr: "/ip4/127.0.0.1/udp/0/quic", + addr: "/ip4/127.0.0.1/udp/0/quic-v1", isFdConsuming: false, }, "addr-without-registered-transport": { diff --git a/p2p/protocol/holepunch/metrics_noalloc_test.go b/p2p/protocol/holepunch/metrics_noalloc_test.go index 968354fd7d..eb04eedff8 100644 --- a/p2p/protocol/holepunch/metrics_noalloc_test.go +++ b/p2p/protocol/holepunch/metrics_noalloc_test.go @@ -14,14 +14,14 @@ func TestNoCoverNoAllocMetrics(t *testing.T) { addrs1 := [][]ma.Multiaddr{ { ma.StringCast("/ip4/0.0.0.0/tcp/1"), - ma.StringCast("/ip4/1.2.3.4/udp/2/quic"), + ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1"), }, nil, } addrs2 := [][]ma.Multiaddr{ { ma.StringCast("/ip4/1.2.3.4/tcp/3"), - ma.StringCast("/ip4/1.2.3.4/udp/4/quic"), + ma.StringCast("/ip4/1.2.3.4/udp/4/quic-v1"), }, nil, } diff --git a/p2p/protocol/holepunch/metrics_test.go b/p2p/protocol/holepunch/metrics_test.go index 6d7bf160d5..9b1b7d9f1e 100644 --- a/p2p/protocol/holepunch/metrics_test.go +++ b/p2p/protocol/holepunch/metrics_test.go @@ -24,8 +24,8 @@ func TestHolePunchOutcomeCounter(t *testing.T) { t1 := ma.StringCast("/ip4/1.2.3.4/tcp/1") t2 := ma.StringCast("/ip4/1.2.3.4/tcp/2") - q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic") - q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic") + q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") + q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1") q1v1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1") diff --git a/p2p/protocol/identify/obsaddr_glass_test.go b/p2p/protocol/identify/obsaddr_glass_test.go index f96d3a3576..d7535de830 100644 --- a/p2p/protocol/identify/obsaddr_glass_test.go +++ b/p2p/protocol/identify/obsaddr_glass_test.go @@ -17,9 +17,9 @@ func TestObservedAddrGroupKey(t *testing.T) { oa3 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.5/tcp/1231")} oa4 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.4/udp/1231")} oa5 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.4/udp/1531")} - oa6 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.4/udp/1531/quic")} - oa7 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.4/udp/1111/quic")} - oa8 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.5/udp/1111/quic")} + oa6 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.4/udp/1531/quic-v1")} + oa7 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.4/udp/1111/quic-v1")} + oa8 := &observedAddr{addr: ma.StringCast("/ip4/1.2.3.5/udp/1111/quic-v1")} // different ports, same IP => same key require.Equal(t, oa1.groupKey(), oa2.groupKey()) diff --git a/p2p/test/quic/quic_test.go b/p2p/test/quic/quic_test.go index 0603c89bc6..2f233acce1 100644 --- a/p2p/test/quic/quic_test.go +++ b/p2p/test/quic/quic_test.go @@ -31,7 +31,7 @@ func TestQUICVersions(t *testing.T) { libp2p.Transport(libp2pquic.NewTransport), libp2p.Transport(webtransport.New), libp2p.ListenAddrStrings( - "/ip4/127.0.0.1/udp/12345/quic", // QUIC draft-29 + "/ip4/127.0.0.1/udp/12345/quic-v1", // QUIC draft-29 "/ip4/127.0.0.1/udp/12345/quic-v1", // QUIC v1 ), ) @@ -85,7 +85,7 @@ func TestDisableQUICDraft29(t *testing.T) { libp2p.Transport(libp2pquic.NewTransport), libp2p.Transport(webtransport.New), libp2p.ListenAddrStrings( - "/ip4/127.0.0.1/udp/12346/quic", // QUIC draft-29 + "/ip4/127.0.0.1/udp/12346/quic-v1", // QUIC draft-29 "/ip4/127.0.0.1/udp/12346/quic-v1", // QUIC v1 ), ) @@ -107,7 +107,7 @@ func TestDisableQUICDraft29(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 300*time.Microsecond) defer cancel() require.ErrorIs(t, - h2.Connect(ctx, peer.AddrInfo{ID: h1.ID(), Addrs: []ma.Multiaddr{ma.StringCast("/ip4/127.0.0.1/udp/12346/quic")}}), + h2.Connect(ctx, peer.AddrInfo{ID: h1.ID(), Addrs: []ma.Multiaddr{ma.StringCast("/ip4/127.0.0.1/udp/12346/quic-v1")}}), context.DeadlineExceeded, ) // make sure that dialing QUIC v1 works diff --git a/p2p/transport/quic/conn_test.go b/p2p/transport/quic/conn_test.go index 189a38dfc5..7b2865c7eb 100644 --- a/p2p/transport/quic/conn_test.go +++ b/p2p/transport/quic/conn_test.go @@ -681,7 +681,7 @@ func TestGetErrorWhenListeningWithDraft29WhenDisabled(t *testing.T) { t1, err := NewTransport(serverKey, newConnManager(t, quicreuse.DisableDraft29()), nil, nil, nil) require.NoError(t, err) defer t1.(io.Closer).Close() - laddr, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/0/quic") + laddr, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/0/quic-v1") require.NoError(t, err) _, err = t1.Listen(laddr) require.Error(t, err) @@ -725,7 +725,7 @@ func TestClientCanDialDifferentQUICVersions(t *testing.T) { mas := []ma.Multiaddr{ln1.Multiaddr()} var ln2 tpt.Listener if !tc.serverDisablesDraft29 { - laddrDraft29 := ma.StringCast("/ip4/127.0.0.1/udp/0/quic") + laddrDraft29 := ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1") ln2, err = t1.Listen(laddrDraft29) require.NoError(t, err) t.Cleanup(func() { ln2.Close() }) diff --git a/p2p/transport/quic/listener_test.go b/p2p/transport/quic/listener_test.go index f62cddc99b..21f450b0f7 100644 --- a/p2p/transport/quic/listener_test.go +++ b/p2p/transport/quic/listener_test.go @@ -34,7 +34,7 @@ func TestListenAddr(t *testing.T) { defer tr.(io.Closer).Close() t.Run("for IPv4", func(t *testing.T) { - localAddr := ma.StringCast("/ip4/127.0.0.1/udp/0/quic") + localAddr := ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1") ln, err := tr.Listen(localAddr) require.NoError(t, err) localAddrV1 := ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1") @@ -54,7 +54,7 @@ func TestListenAddr(t *testing.T) { }) t.Run("for IPv6", func(t *testing.T) { - localAddr := ma.StringCast("/ip6/::/udp/0/quic") + localAddr := ma.StringCast("/ip6/::/udp/0/quic-v1") ln, err := tr.Listen(localAddr) require.NoError(t, err) localAddrV1 := ma.StringCast("/ip6/::/udp/0/quic-v1") @@ -76,7 +76,7 @@ func TestListenAddr(t *testing.T) { func TestAccepting(t *testing.T) { tr := newTransport(t, nil) defer tr.(io.Closer).Close() - ln, err := tr.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic")) + ln, err := tr.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1")) require.NoError(t, err) done := make(chan struct{}) go func() { @@ -100,7 +100,7 @@ func TestAccepting(t *testing.T) { func TestAcceptAfterClose(t *testing.T) { tr := newTransport(t, nil) defer tr.(io.Closer).Close() - ln, err := tr.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic")) + ln, err := tr.Listen(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1")) require.NoError(t, err) require.NoError(t, ln.Close()) _, err = ln.Accept() @@ -112,7 +112,7 @@ func TestCorrectNumberOfVirtualListeners(t *testing.T) { tpt := tr.(*transport) defer tr.(io.Closer).Close() - localAddr := ma.StringCast("/ip4/127.0.0.1/udp/0/quic") + localAddr := ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1") udpAddr, _, err := quicreuse.FromQuicMultiaddr(localAddr) require.NoError(t, err) diff --git a/p2p/transport/quic/transport_test.go b/p2p/transport/quic/transport_test.go index 3eab8281ec..3fbd0c331b 100644 --- a/p2p/transport/quic/transport_test.go +++ b/p2p/transport/quic/transport_test.go @@ -48,11 +48,11 @@ func TestCanDial(t *testing.T) { invalid := []string{ "/ip4/127.0.0.1/udp/1234", "/ip4/5.5.5.5/tcp/1234", - "/dns/google.com/udp/443/quic", + "/dns/google.com/udp/443/quic-v1", } valid := []string{ - "/ip4/127.0.0.1/udp/1234/quic", - "/ip4/5.5.5.5/udp/0/quic", + "/ip4/127.0.0.1/udp/1234/quic-v1", + "/ip4/5.5.5.5/udp/0/quic-v1", } for _, s := range invalid { invalidAddr, err := ma.NewMultiaddr(s) diff --git a/p2p/transport/quicreuse/connmgr_test.go b/p2p/transport/quicreuse/connmgr_test.go index 92c7e31250..5f2108433b 100644 --- a/p2p/transport/quicreuse/connmgr_test.go +++ b/p2p/transport/quicreuse/connmgr_test.go @@ -43,7 +43,7 @@ func TestListenQUICDraft29Disabled(t *testing.T) { cm, err := NewConnManager([32]byte{}, DisableDraft29(), DisableReuseport()) require.NoError(t, err) defer cm.Close() - _, err = cm.ListenQUIC(ma.StringCast("/ip4/127.0.0.1/udp/0/quic"), &tls.Config{}, nil) + _, err = cm.ListenQUIC(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1"), &tls.Config{}, nil) require.EqualError(t, err, "can't listen on `/quic` multiaddr (QUIC draft 29 version) when draft 29 support is disabled") ln, err := cm.ListenQUIC(ma.StringCast("/ip4/127.0.0.1/udp/0/quic-v1"), &tls.Config{NextProtos: []string{"proto"}}, nil) require.NoError(t, err) diff --git a/p2p/transport/quicreuse/quic_multiaddr_test.go b/p2p/transport/quicreuse/quic_multiaddr_test.go index 23a8b0babd..fdf79a6285 100644 --- a/p2p/transport/quicreuse/quic_multiaddr_test.go +++ b/p2p/transport/quicreuse/quic_multiaddr_test.go @@ -13,7 +13,7 @@ func TestConvertToQuicMultiaddr(t *testing.T) { addr := &net.UDPAddr{IP: net.IPv4(192, 168, 0, 42), Port: 1337} maddr, err := ToQuicMultiaddr(addr, quic.VersionDraft29) require.NoError(t, err) - require.Equal(t, maddr.String(), "/ip4/192.168.0.42/udp/1337/quic") + require.Equal(t, maddr.String(), "/ip4/192.168.0.42/udp/1337/quic-v1") } func TestConvertToQuicV1Multiaddr(t *testing.T) { @@ -24,7 +24,7 @@ func TestConvertToQuicV1Multiaddr(t *testing.T) { } func TestConvertFromQuicDraft29Multiaddr(t *testing.T) { - maddr, err := ma.NewMultiaddr("/ip4/192.168.0.42/udp/1337/quic") + maddr, err := ma.NewMultiaddr("/ip4/192.168.0.42/udp/1337/quic-v1") require.NoError(t, err) udpAddr, v, err := FromQuicMultiaddr(maddr) require.NoError(t, err) diff --git a/test-plans/cmd/ping/main.go b/test-plans/cmd/ping/main.go index 24a3dbc1dc..79ddb4e740 100644 --- a/test-plans/cmd/ping/main.go +++ b/test-plans/cmd/ping/main.go @@ -100,7 +100,7 @@ func main() { listenAddr = fmt.Sprintf("/ip4/%s/tcp/0", ip) case "quic": options = append(options, libp2p.Transport(libp2pquic.NewTransport)) - listenAddr = fmt.Sprintf("/ip4/%s/udp/0/quic", ip) + listenAddr = fmt.Sprintf("/ip4/%s/udp/0/quic-v1", ip) case "quic-v1": options = append(options, libp2p.Transport(libp2pquic.NewTransport)) listenAddr = fmt.Sprintf("/ip4/%s/udp/0/quic-v1", ip)