clean up dial functions

* add a context to all Dial functions
* remove the explicit Dial{*}Context functions
This commit is contained in:
Marten Seemann 2023-04-06 18:32:46 +08:00
parent d683b841c4
commit aee7706d5d
32 changed files with 106 additions and 59 deletions

View file

@ -36,7 +36,7 @@ func BenchmarkHandshake(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
c, err := quic.Dial(conn, ln.Addr(), tlsClientConfig, nil)
c, err := quic.Dial(context.Background(), conn, ln.Addr(), tlsClientConfig, nil)
if err != nil {
b.Fatal(err)
}
@ -71,7 +71,7 @@ func BenchmarkStreamChurn(b *testing.B) {
}
}()
c, err := quic.DialAddr(fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port), tlsClientConfig, nil)
c, err := quic.DialAddr(context.Background(), fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port), tlsClientConfig, nil)
if err != nil {
b.Fatal(err)
}

View file

@ -73,6 +73,7 @@ var _ = Describe("Stream Cancellations", func() {
It("downloads when the client immediately cancels most streams", func() {
serverCanceledCounterChan := runServer(PRData)
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 2}),
@ -124,6 +125,7 @@ var _ = Describe("Stream Cancellations", func() {
serverCanceledCounterChan := runServer(PRData)
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 2}),
@ -174,6 +176,7 @@ var _ = Describe("Stream Cancellations", func() {
serverCanceledCounterChan := runServer(make([]byte, 100)) // make sure the FIN is sent with the STREAM frame
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 2}),
@ -221,6 +224,7 @@ var _ = Describe("Stream Cancellations", func() {
Context("canceling the write side", func() {
runClient := func(server quic.Listener) int32 /* number of canceled streams */ {
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 2}),
@ -366,6 +370,7 @@ var _ = Describe("Stream Cancellations", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 2}),
@ -451,6 +456,7 @@ var _ = Describe("Stream Cancellations", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 2}),
@ -529,6 +535,7 @@ var _ = Describe("Stream Cancellations", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: numStreams / 3}),
@ -614,6 +621,7 @@ var _ = Describe("Stream Cancellations", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIncomingUniStreams: maxIncomingStreams}),
@ -707,6 +715,7 @@ var _ = Describe("Stream Cancellations", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{}),

View file

@ -44,6 +44,7 @@ var _ = Describe("Connection ID lengths tests", func() {
defer proxy.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -61,6 +61,7 @@ var _ = Describe("Connection ID lengths tests", func() {
runClient := func(addr net.Addr, conf *quic.Config) {
GinkgoWriter.Write([]byte(fmt.Sprintf("Using %d byte connection ID for the client\n", conf.ConnectionIDLength)))
cl, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", addr.(*net.UDPAddr).Port),
getTLSClientConfig(),
conf,

View file

@ -105,6 +105,7 @@ var _ = Describe("Datagram test", func() {
raddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("localhost:%d", proxy.LocalPort()))
Expect(err).ToNot(HaveOccurred())
conn, err := quic.Dial(
context.Background(),
clientConn,
raddr,
getTLSClientConfig(),
@ -140,6 +141,7 @@ var _ = Describe("Datagram test", func() {
raddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("localhost:%d", proxy.LocalPort()))
Expect(err).ToNot(HaveOccurred())
conn, err := quic.Dial(
context.Background(),
clientConn,
raddr,
getTLSClientConfig(),
@ -157,6 +159,7 @@ var _ = Describe("Datagram test", func() {
raddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("localhost:%d", proxy.LocalPort()))
Expect(err).ToNot(HaveOccurred())
conn, err := quic.Dial(
context.Background(),
clientConn,
raddr,
getTLSClientConfig(),

View file

@ -30,6 +30,7 @@ var _ = Describe("Stream deadline tests", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -97,6 +97,7 @@ var _ = Describe("Drop Tests", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -50,6 +50,7 @@ var _ = Describe("early data", func() {
defer proxy.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -81,6 +81,7 @@ var _ = Describe("Handshake drop tests", func() {
serverConnChan <- conn
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -118,6 +119,7 @@ var _ = Describe("Handshake drop tests", func() {
serverConnChan <- conn
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -150,6 +152,7 @@ var _ = Describe("Handshake drop tests", func() {
serverConnChan <- conn
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{

View file

@ -63,6 +63,7 @@ var _ = Describe("Handshake RTT tests", func() {
runProxy(ln.Addr())
startTime := time.Now()
_, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalAddr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -79,6 +80,7 @@ var _ = Describe("Handshake RTT tests", func() {
runProxy(ln.Addr())
startTime := time.Now()
_, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalAddr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -96,6 +98,7 @@ var _ = Describe("Handshake RTT tests", func() {
runProxy(ln.Addr())
startTime := time.Now()
_, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalAddr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -122,6 +125,7 @@ var _ = Describe("Handshake RTT tests", func() {
runProxy(ln.Addr())
startTime := time.Now()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalAddr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -156,6 +160,7 @@ var _ = Describe("Handshake RTT tests", func() {
runProxy(ln.Addr())
startTime := time.Now()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalAddr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -111,6 +111,7 @@ var _ = Describe("Handshake tests", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
nil,
@ -131,6 +132,7 @@ var _ = Describe("Handshake tests", func() {
It("accepts the certificate", func() {
runServer(getTLSConfig())
_, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -141,6 +143,7 @@ var _ = Describe("Handshake tests", func() {
It("works with a long certificate chain", func() {
runServer(getTLSConfigWithLongCertChain())
_, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -155,6 +158,7 @@ var _ = Describe("Handshake tests", func() {
conf := getTLSClientConfig()
conf.ServerName = "foo.bar"
_, err = quic.Dial(
context.Background(),
conn,
server.Addr(),
conf,
@ -173,6 +177,7 @@ var _ = Describe("Handshake tests", func() {
runServer(tlsConf)
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -201,6 +206,7 @@ var _ = Describe("Handshake tests", func() {
tlsConf := getTLSClientConfig()
tlsConf.ServerName = "foo.bar"
_, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
tlsConf,
getQuicConfig(nil),
@ -223,7 +229,7 @@ var _ = Describe("Handshake tests", func() {
remoteAddr := fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port)
raddr, err := net.ResolveUDPAddr("udp", remoteAddr)
Expect(err).ToNot(HaveOccurred())
return quic.Dial(pconn, raddr, getTLSClientConfig(), nil)
return quic.Dial(context.Background(), pconn, raddr, getTLSClientConfig(), nil)
}
BeforeEach(func() {
@ -324,6 +330,7 @@ var _ = Describe("Handshake tests", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
nil,
@ -342,6 +349,7 @@ var _ = Describe("Handshake tests", func() {
tlsConf := getTLSClientConfig()
tlsConf.NextProtos = []string{"foobar"}
_, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
tlsConf,
nil,
@ -371,6 +379,7 @@ var _ = Describe("Handshake tests", func() {
tokenStore := newTokenStore(gets, puts)
quicConf := getQuicConfig(&quic.Config{TokenStore: tokenStore})
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
quicConf,
@ -390,6 +399,7 @@ var _ = Describe("Handshake tests", func() {
Expect(err).ToNot(HaveOccurred())
}()
conn, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
quicConf,
@ -410,6 +420,7 @@ var _ = Describe("Handshake tests", func() {
defer server.Close()
_, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
nil,
@ -441,6 +452,7 @@ var _ = Describe("Handshake tests", func() {
tlsConf := getTLSClientConfig()
tlsConf.NextProtos = []string{""}
_, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", ln.LocalAddr().(*net.UDPAddr).Port),
tlsConf,
nil,

View file

@ -72,6 +72,7 @@ var _ = Describe("Key Update tests", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{Tracer: newTracer(func() logging.ConnectionTracer { return &keyUpdateConnTracer{} })}),

View file

@ -147,6 +147,7 @@ var _ = Describe("MITM test", func() {
raddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("localhost:%d", proxyPort))
Expect(err).ToNot(HaveOccurred())
conn, err := quic.Dial(
context.Background(),
clientUDPConn,
raddr,
getTLSClientConfig(),
@ -190,6 +191,7 @@ var _ = Describe("MITM test", func() {
raddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("localhost:%d", proxyPort))
Expect(err).ToNot(HaveOccurred())
conn, err := quic.Dial(
context.Background(),
clientUDPConn,
raddr,
getTLSClientConfig(),
@ -304,6 +306,7 @@ var _ = Describe("MITM test", func() {
raddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("localhost:%d", proxyPort))
Expect(err).ToNot(HaveOccurred())
_, err = quic.Dial(
context.Background(),
clientUDPConn,
raddr,
getTLSClientConfig(),

View file

@ -36,6 +36,7 @@ var _ = Describe("Multiplexing", func() {
dial := func(pconn net.PacketConn, addr net.Addr) {
conn, err := quic.Dial(
context.Background(),
pconn,
addr,
getTLSClientConfig(),

View file

@ -45,6 +45,7 @@ var _ = Describe("Packetization", func() {
clientTracer := newPacketTracer()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{

View file

@ -58,6 +58,7 @@ var _ = Describe("TLS session resumption", func() {
tlsConf := getTLSClientConfig()
tlsConf.ClientSessionCache = cache
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
tlsConf,
nil,
@ -72,6 +73,7 @@ var _ = Describe("TLS session resumption", func() {
Expect(serverConn.ConnectionState().TLS.DidResume).To(BeFalse())
conn, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
tlsConf,
nil,
@ -98,6 +100,7 @@ var _ = Describe("TLS session resumption", func() {
tlsConf := getTLSClientConfig()
tlsConf.ClientSessionCache = cache
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
tlsConf,
nil,
@ -111,6 +114,7 @@ var _ = Describe("TLS session resumption", func() {
Expect(serverConn.ConnectionState().TLS.DidResume).To(BeFalse())
conn, err = quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
tlsConf,
nil,

View file

@ -37,6 +37,7 @@ var _ = Describe("non-zero RTT", func() {
downloadFile := func(port int) {
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", port),
getTLSClientConfig(),
getQuicConfig(nil),
@ -72,6 +73,7 @@ var _ = Describe("non-zero RTT", func() {
defer proxy.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -56,6 +56,7 @@ var _ = Describe("Stateless Resets", func() {
defer proxy.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{

View file

@ -87,6 +87,7 @@ var _ = Describe("Bidirectional streams", func() {
}()
client, err := quic.DialAddr(
context.Background(),
serverAddr,
getTLSClientConfig(),
getQuicConfig(nil),
@ -105,6 +106,7 @@ var _ = Describe("Bidirectional streams", func() {
}()
client, err := quic.DialAddr(
context.Background(),
serverAddr,
getTLSClientConfig(),
getQuicConfig(nil),
@ -132,6 +134,7 @@ var _ = Describe("Bidirectional streams", func() {
}()
client, err := quic.DialAddr(
context.Background(),
serverAddr,
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -54,6 +54,7 @@ var _ = Describe("Timeout tests", func() {
errChan := make(chan error)
go func() {
_, err := quic.DialAddr(
context.Background(),
"localhost:12345",
getTLSClientConfig(),
getQuicConfig(&quic.Config{HandshakeIdleTimeout: 10 * time.Millisecond}),
@ -70,7 +71,7 @@ var _ = Describe("Timeout tests", func() {
defer cancel()
errChan := make(chan error)
go func() {
_, err := quic.DialAddrContext(
_, err := quic.DialAddr(
ctx,
"localhost:12345",
getTLSClientConfig(),
@ -89,7 +90,7 @@ var _ = Describe("Timeout tests", func() {
defer cancel()
errChan := make(chan error)
go func() {
_, err := quic.DialAddrEarlyContext(
_, err := quic.DialAddrEarly(
ctx,
"localhost:12345",
getTLSClientConfig(),
@ -135,6 +136,7 @@ var _ = Describe("Timeout tests", func() {
defer proxy.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true, MaxIdleTimeout: idleTimeout}),
@ -194,6 +196,7 @@ var _ = Describe("Timeout tests", func() {
tr := newPacketTracer()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -273,6 +276,7 @@ var _ = Describe("Timeout tests", func() {
}()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIdleTimeout: idleTimeout, DisablePathMTUDiscovery: true}),
@ -341,6 +345,7 @@ var _ = Describe("Timeout tests", func() {
defer proxy.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -423,6 +428,7 @@ var _ = Describe("Timeout tests", func() {
go func() {
defer GinkgoRecover()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
@ -484,6 +490,7 @@ var _ = Describe("Timeout tests", func() {
go func() {
defer GinkgoRecover()
conn, err := quic.Dial(
context.Background(),
&faultyConn{PacketConn: conn, MaxPackets: maxPackets},
ln.Addr(),
getTLSClientConfig(),

View file

@ -80,6 +80,7 @@ var _ = Describe("Handshake tests", func() {
defer ln.Close()
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
quicClientConf,

View file

@ -77,6 +77,7 @@ var _ = Describe("Unidirectional Streams", func() {
}()
client, err := quic.DialAddr(
context.Background(),
serverAddr,
getTLSClientConfig(),
getQuicConfig(nil),
@ -95,6 +96,7 @@ var _ = Describe("Unidirectional Streams", func() {
}()
client, err := quic.DialAddr(
context.Background(),
serverAddr,
getTLSClientConfig(),
getQuicConfig(nil),
@ -121,6 +123,7 @@ var _ = Describe("Unidirectional Streams", func() {
}()
client, err := quic.DialAddr(
context.Background(),
serverAddr,
getTLSClientConfig(),
getQuicConfig(nil),

View file

@ -86,6 +86,7 @@ var _ = Describe("0-RTT", func() {
puts := make(chan string, 100)
clientConf.ClientSessionCache = newClientSessionCache(gets, puts)
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
clientConf,
getQuicConfig(nil),
@ -126,6 +127,7 @@ var _ = Describe("0-RTT", func() {
clientConf = getQuicConfig(nil)
}
conn, err := quic.DialAddrEarly(
context.Background(),
fmt.Sprintf("localhost:%d", proxyPort),
clientTLSConf,
clientConf,
@ -151,6 +153,7 @@ var _ = Describe("0-RTT", func() {
clientConf *tls.Config,
) {
conn, err := quic.DialAddrEarly(
context.Background(),
fmt.Sprintf("localhost:%d", proxyPort),
clientConf,
getQuicConfig(nil),
@ -280,6 +283,7 @@ var _ = Describe("0-RTT", func() {
defer proxy.Close()
conn, err := quic.DialAddrEarly(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
clientConf,
getQuicConfig(nil),
@ -479,6 +483,7 @@ var _ = Describe("0-RTT", func() {
defer proxy.Close()
conn, err := quic.DialAddrEarly(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
clientConf,
getQuicConfig(nil),
@ -609,6 +614,7 @@ var _ = Describe("0-RTT", func() {
defer proxy.Close()
conn, err := quic.DialAddrEarly(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
clientConf,
getQuicConfig(nil),
@ -680,6 +686,7 @@ var _ = Describe("0-RTT", func() {
defer proxy.Close()
conn, err := quic.DialAddrEarly(
context.Background(),
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
clientConf,
getQuicConfig(nil),

View file

@ -69,7 +69,7 @@ var _ = Describe("Handshake tests", func() {
var supportedVersions []protocol.VersionNumber
BeforeEach(func() {
supportedVersions = protocol.SupportedVersions
supportedVersions = append([]quic.VersionNumber{}, protocol.SupportedVersions...)
protocol.SupportedVersions = append(protocol.SupportedVersions, []protocol.VersionNumber{7, 8, 9, 10}...)
})
@ -90,6 +90,7 @@ var _ = Describe("Handshake tests", func() {
defer cl()
clientTracer := &versionNegotiationTracer{}
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
maybeAddQlogTracer(&quic.Config{Tracer: newTracer(func() logging.ConnectionTracer { return clientTracer })}),
@ -119,6 +120,7 @@ var _ = Describe("Handshake tests", func() {
clientVersions := []protocol.VersionNumber{7, 8, 9, protocol.SupportedVersions[0], 10}
clientTracer := &versionNegotiationTracer{}
conn, err := quic.DialAddr(
context.Background(),
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
maybeAddQlogTracer(&quic.Config{

View file

@ -1,6 +1,7 @@
package versionnegotiation
import (
"context"
"time"
"github.com/quic-go/quic-go"
@ -43,6 +44,7 @@ var _ = Describe("Handshake RTT tests", func() {
startTime := time.Now()
_, err = quic.DialAddr(
context.Background(),
proxy.LocalAddr().String(),
getTLSClientConfig(),
maybeAddQlogTracer(&quic.Config{Versions: protocol.SupportedVersions[1:2]}),