From 1fd02162fc78587a13bbddac3f950da0c7316eeb Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sun, 3 Apr 2022 14:27:55 +0100 Subject: [PATCH] remove unneeded network from custom dial function used in HTTP/3 (#3368) --- http3/client.go | 4 ++-- http3/client_test.go | 3 +-- http3/roundtrip.go | 2 +- http3/roundtrip_test.go | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/http3/client.go b/http3/client.go index c4c6ec6cc54..498e2e75ee3 100644 --- a/http3/client.go +++ b/http3/client.go @@ -34,7 +34,7 @@ var defaultQuicConfig = &quic.Config{ Versions: []protocol.VersionNumber{protocol.VersionTLS}, } -type dialFunc func(ctx context.Context, network, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) +type dialFunc func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) var dialAddr = quic.DialAddrEarlyContext @@ -101,7 +101,7 @@ func newClient(hostname string, tlsConf *tls.Config, opts *roundTripperOpts, con func (c *client) dial(ctx context.Context) error { var err error if c.dialer != nil { - c.conn, err = c.dialer(ctx, "udp", c.hostname, c.tlsConf, c.config) + c.conn, err = c.dialer(ctx, c.hostname, c.tlsConf, c.config) } else { c.conn, err = dialAddr(ctx, c.hostname, c.tlsConf, c.config) } diff --git a/http3/client_test.go b/http3/client_test.go index 4295fcd00e3..0cab46d0788 100644 --- a/http3/client_test.go +++ b/http3/client_test.go @@ -121,9 +121,8 @@ var _ = Describe("Client", func() { ctx, cancel := context.WithTimeout(context.Background(), time.Hour) defer cancel() var dialerCalled bool - dialer := func(ctxP context.Context, network, address string, tlsConfP *tls.Config, quicConfP *quic.Config) (quic.EarlyConnection, error) { + dialer := func(ctxP context.Context, address string, tlsConfP *tls.Config, quicConfP *quic.Config) (quic.EarlyConnection, error) { Expect(ctxP).To(Equal(ctx)) - Expect(network).To(Equal("udp")) Expect(address).To(Equal("localhost:1337")) Expect(tlsConfP.ServerName).To(Equal("foo.bar")) Expect(quicConfP.MaxIdleTimeout).To(Equal(quicConf.MaxIdleTimeout)) diff --git a/http3/roundtrip.go b/http3/roundtrip.go index 59d20f78d99..156fddabee3 100644 --- a/http3/roundtrip.go +++ b/http3/roundtrip.go @@ -50,7 +50,7 @@ type RoundTripper struct { // Dial specifies an optional dial function for creating QUIC // connections for requests. // If Dial is nil, quic.DialAddrEarlyContext will be used. - Dial func(ctx context.Context, network, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) + Dial func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) // MaxResponseHeaderBytes specifies a limit on how many response bytes are // allowed in the server's response header. diff --git a/http3/roundtrip_test.go b/http3/roundtrip_test.go index 1343de529e6..a17cf4db087 100644 --- a/http3/roundtrip_test.go +++ b/http3/roundtrip_test.go @@ -127,7 +127,7 @@ var _ = Describe("RoundTripper", func() { It("uses the custom dialer, if provided", func() { var dialed bool - dialer := func(_ context.Context, _, _ string, tlsCfgP *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) { + dialer := func(_ context.Context, _ string, tlsCfgP *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) { dialed = true return nil, errors.New("handshake error") }