Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quic: drop support for QUIC draft-29 #2487

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down
6 changes: 3 additions & 3 deletions libp2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
}
Expand All @@ -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-v1")))
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())
Expand Down
16 changes: 8 additions & 8 deletions p2p/host/autorelay/addrsplosion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
})
Expand All @@ -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")
})
Expand All @@ -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")
})
Expand Down
59 changes: 20 additions & 39 deletions p2p/net/swarm/dial_ranker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -70,14 +70,10 @@ func TestNoDelayDialRanker(t *testing.T) {
}

func TestDelayRankerQUICDelay(t *testing.T) {
q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic")
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")
q2v1 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1")
q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic")
q3v1 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic-v1")
q4 := ma.StringCast("/ip4/1.2.3.4/udp/4/quic")

q1v16 := ma.StringCast("/ip6/1::2/udp/1/quic-v1")
q2v16 := ma.StringCast("/ip6/1::2/udp/2/quic-v1")
Expand All @@ -90,12 +86,11 @@ func TestDelayRankerQUICDelay(t *testing.T) {
}{
{
name: "quic-ipv4",
addrs: []ma.Multiaddr{q1, q2, q3, q4},
addrs: []ma.Multiaddr{q1v1, q2v1, q3v1},
output: []network.AddrDelay{
{Addr: q1, Delay: 0},
{Addr: q2, Delay: PublicQUICDelay},
{Addr: q3, Delay: PublicQUICDelay},
{Addr: q4, Delay: PublicQUICDelay},
{Addr: q1v1, Delay: 0},
{Addr: q2v1, Delay: PublicQUICDelay},
{Addr: q3v1, Delay: PublicQUICDelay},
},
},
{
Expand All @@ -109,37 +104,29 @@ func TestDelayRankerQUICDelay(t *testing.T) {
},
{
name: "quic-ip4-ip6",
addrs: []ma.Multiaddr{q1, q1v16, q2v1, q3, q4},
addrs: []ma.Multiaddr{q1v16, q2v1},
output: []network.AddrDelay{
{Addr: q1v16, Delay: 0},
{Addr: q2v1, Delay: PublicQUICDelay},
{Addr: q1, Delay: 2 * PublicQUICDelay},
{Addr: q3, Delay: 2 * PublicQUICDelay},
{Addr: q4, Delay: 2 * PublicQUICDelay},
},
},
{
name: "quic-quic-v1-webtransport",
addrs: []ma.Multiaddr{q1v16, q1, q2, q3, q4, q1v1, q2v1, q3v1, wt1},
addrs: []ma.Multiaddr{q1v16, q1v1, q2v1, q3v1, wt1},
output: []network.AddrDelay{
{Addr: q1v16, Delay: 0},
{Addr: q1v1, Delay: PublicQUICDelay},
{Addr: q2v1, Delay: 2 * PublicQUICDelay},
{Addr: q3v1, Delay: 2 * PublicQUICDelay},
{Addr: q1, Delay: 2 * PublicQUICDelay},
{Addr: q2, Delay: 2 * PublicQUICDelay},
{Addr: q3, Delay: 2 * PublicQUICDelay},
{Addr: q4, Delay: 2 * PublicQUICDelay},
{Addr: wt1, Delay: 2 * PublicQUICDelay},
},
},
{
name: "wt-ranking",
addrs: []ma.Multiaddr{q1v16, q2v16, q3v16, q2, wt1},
addrs: []ma.Multiaddr{q1v16, q2v16, q3v16, wt1},
output: []network.AddrDelay{
{Addr: q1v16, Delay: 0},
{Addr: q2, Delay: PublicQUICDelay},
{Addr: wt1, Delay: 2 * PublicQUICDelay},
{Addr: wt1, Delay: PublicQUICDelay},
{Addr: q2v16, Delay: 2 * PublicQUICDelay},
{Addr: q3v16, Delay: 2 * PublicQUICDelay},
},
Expand All @@ -164,11 +151,8 @@ func TestDelayRankerQUICDelay(t *testing.T) {
}

func TestDelayRankerTCPDelay(t *testing.T) {
q1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic")
q1v1 := ma.StringCast("/ip4/1.2.3.4/udp/1/quic-v1")
q2 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic")
q2v1 := ma.StringCast("/ip4/1.2.3.4/udp/2/quic-v1")
q3 := ma.StringCast("/ip4/1.2.3.4/udp/3/quic")

q1v16 := ma.StringCast("/ip6/1::2/udp/1/quic-v1")
q2v16 := ma.StringCast("/ip6/1::2/udp/2/quic-v1")
Expand All @@ -185,11 +169,10 @@ func TestDelayRankerTCPDelay(t *testing.T) {
}{
{
name: "quic-with-tcp-ip6-ip4",
addrs: []ma.Multiaddr{q1, q1v1, q1v16, q2v16, q3v16, q2v1, t1, t2},
addrs: []ma.Multiaddr{q1v1, q1v16, q2v16, q3v16, q2v1, t1, t2},
output: []network.AddrDelay{
{Addr: q1v16, Delay: 0},
{Addr: q1v1, Delay: PublicQUICDelay},
{Addr: q1, Delay: 2 * PublicQUICDelay},
{Addr: q2v16, Delay: 2 * PublicQUICDelay},
{Addr: q3v16, Delay: 2 * PublicQUICDelay},
{Addr: q2v1, Delay: 2 * PublicQUICDelay},
Expand All @@ -199,14 +182,12 @@ func TestDelayRankerTCPDelay(t *testing.T) {
},
{
name: "quic-ip4-with-tcp",
addrs: []ma.Multiaddr{q1, q2, q3, t1, t2, t1v6},
addrs: []ma.Multiaddr{q1v1, t1, t2, t1v6},
output: []network.AddrDelay{
{Addr: q1, Delay: 0},
{Addr: q2, Delay: PublicQUICDelay},
{Addr: q3, Delay: PublicQUICDelay},
{Addr: t1, Delay: PublicQUICDelay + PublicTCPDelay},
{Addr: t2, Delay: PublicQUICDelay + PublicTCPDelay},
{Addr: t1v6, Delay: PublicQUICDelay + PublicTCPDelay},
{Addr: q1v1, Delay: 0},
{Addr: t1, Delay: PublicTCPDelay},
{Addr: t2, Delay: PublicTCPDelay},
{Addr: t1v6, Delay: PublicTCPDelay},
},
},
{
Expand Down Expand Up @@ -238,8 +219,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))
Expand Down
10 changes: 5 additions & 5 deletions p2p/net/swarm/dial_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion p2p/net/swarm/swarm_addr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down
6 changes: 3 additions & 3 deletions p2p/net/swarm/swarm_dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion p2p/net/swarm/swarm_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++ {
Expand Down
2 changes: 1 addition & 1 deletion p2p/net/swarm/swarm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion p2p/net/swarm/testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion p2p/net/swarm/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions p2p/protocol/holepunch/metrics_noalloc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
Loading