Browse Source
quic: disable sending of Version Negotiation packets (#2015)
marco/test-tidy
Marten Seemann
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
3 deletions
-
p2p/test/quic/quic_test.go
-
p2p/transport/quicreuse/config.go
|
|
@ -3,6 +3,7 @@ package quic_test |
|
|
|
import ( |
|
|
|
"context" |
|
|
|
"testing" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/libp2p/go-libp2p" |
|
|
|
"github.com/libp2p/go-libp2p/core/network" |
|
|
@ -99,9 +100,13 @@ func TestDisableQUICDraft29(t *testing.T) { |
|
|
|
) |
|
|
|
require.NoError(t, err) |
|
|
|
defer h2.Close() |
|
|
|
require.ErrorContains(t, |
|
|
|
h2.Connect(context.Background(), peer.AddrInfo{ID: h1.ID(), Addrs: []ma.Multiaddr{ma.StringCast("/ip4/127.0.0.1/udp/12346/quic")}}), |
|
|
|
"no compatible QUIC version found", |
|
|
|
// We disabled QUIC Version Negotiation, so we will _not_ receive a Version Negotiation packet.
|
|
|
|
// Instead, the connection will run into the context timeout.
|
|
|
|
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")}}), |
|
|
|
context.DeadlineExceeded, |
|
|
|
) |
|
|
|
// make sure that dialing QUIC v1 works
|
|
|
|
require.NoError(t, h2.Connect(context.Background(), peer.AddrInfo{ID: h1.ID(), Addrs: []ma.Multiaddr{addrs[0]}})) |
|
|
|
|
|
@ -20,4 +20,6 @@ var quicConfig = &quic.Config{ |
|
|
|
Versions: []quic.VersionNumber{quic.VersionDraft29, quic.Version1}, |
|
|
|
// We don't use datagrams (yet), but this is necessary for WebTransport
|
|
|
|
EnableDatagrams: true, |
|
|
|
// The multiaddress encodes the QUIC version, thus there's no need to send Version Negotiation packets.
|
|
|
|
DisableVersionNegotiationPackets: true, |
|
|
|
} |
|
|
|