http3: rename RoundTripper.QuicConfig to RoundTripper.QUICConfig (#4385)

This commit is contained in:
Marten Seemann
2024-03-24 08:29:39 +10:00
committed by GitHub
parent 89020e380a
commit 49b9965525
6 changed files with 13 additions and 13 deletions

View File

@@ -46,7 +46,7 @@ func main() {
InsecureSkipVerify: *insecure,
KeyLogWriter: keyLog,
},
QuicConfig: &quic.Config{
QUICConfig: &quic.Config{
Tracer: qlog.DefaultTracer,
},
}

View File

@@ -70,12 +70,12 @@ type RoundTripper struct {
// tls.Client. If nil, the default configuration is used.
TLSClientConfig *tls.Config
// QuicConfig is the quic.Config used for dialing new connections.
// QUICConfig is the quic.Config used for dialing new connections.
// If nil, reasonable default values will be used.
QuicConfig *quic.Config
QUICConfig *quic.Config
// Enable support for HTTP/3 datagrams (RFC 9297).
// If a QuicConfig is set, datagram support also needs to be enabled on the QUIC layer by setting EnableDatagrams.
// If a QUICConfig is set, datagram support also needs to be enabled on the QUIC layer by setting EnableDatagrams.
EnableDatagrams bool
// Additional HTTP/3 settings.
@@ -217,7 +217,7 @@ func (r *RoundTripper) getClient(hostname string, onlyCached bool) (rtc *roundTr
UniStreamHijacker: r.UniStreamHijacker,
AdditionalSettings: r.AdditionalSettings,
},
r.QuicConfig,
r.QUICConfig,
dial,
)
if err != nil {

View File

@@ -93,21 +93,21 @@ var _ = Describe("RoundTripper", func() {
receivedConfig = config
return nil, errors.New("handshake error")
}
rt.QuicConfig = config
rt.QUICConfig = config
_, err := rt.RoundTrip(req)
Expect(err).To(MatchError("handshake error"))
Expect(receivedConfig.HandshakeIdleTimeout).To(Equal(config.HandshakeIdleTimeout))
})
It("requires quic.Config.EnableDatagram if HTTP datagrams are enabled", func() {
rt.QuicConfig = &quic.Config{EnableDatagrams: false}
rt.QUICConfig = &quic.Config{EnableDatagrams: false}
rt.Dial = func(_ context.Context, _ string, _ *tls.Config, config *quic.Config) (quic.EarlyConnection, error) {
return nil, errors.New("handshake error")
}
rt.EnableDatagrams = true
_, err := rt.RoundTrip(req)
Expect(err).To(MatchError("HTTP Datagrams enabled, but QUIC Datagrams disabled"))
rt.QuicConfig.EnableDatagrams = true
rt.QUICConfig.EnableDatagrams = true
_, err = rt.RoundTrip(req)
Expect(err).To(MatchError("handshake error"))
})

View File

@@ -110,7 +110,7 @@ var _ = Describe("HTTP3 Server hotswap test", func() {
rt = &http3.RoundTripper{
TLSClientConfig: getTLSClientConfig(),
DisableCompression: true,
QuicConfig: getQuicConfig(&quic.Config{MaxIdleTimeout: 10 * time.Second}),
QUICConfig: getQuicConfig(&quic.Config{MaxIdleTimeout: 10 * time.Second}),
}
client = &http.Client{Transport: rt}
})

View File

@@ -116,7 +116,7 @@ var _ = Describe("HTTP tests", func() {
BeforeEach(func() {
rt = &http3.RoundTripper{
TLSClientConfig: getTLSClientConfigWithoutServerName(),
QuicConfig: getQuicConfig(&quic.Config{
QUICConfig: getQuicConfig(&quic.Config{
MaxIdleTimeout: 10 * time.Second,
Allow0RTT: true,
}),
@@ -604,7 +604,7 @@ var _ = Describe("HTTP tests", func() {
tlsConf.ClientSessionCache = newClientSessionCache(tls.NewLRUClientSessionCache(10), nil, puts)
rt := &http3.RoundTripper{
TLSClientConfig: tlsConf,
QuicConfig: getQuicConfig(&quic.Config{
QUICConfig: getQuicConfig(&quic.Config{
MaxIdleTimeout: 10 * time.Second,
Allow0RTT: true,
}),
@@ -628,7 +628,7 @@ var _ = Describe("HTTP tests", func() {
rt2 := &http3.RoundTripper{
TLSClientConfig: rt.TLSClientConfig,
QuicConfig: rt.QuicConfig,
QUICConfig: rt.QUICConfig,
DisableCompression: true,
}
defer rt2.Close()

View File

@@ -69,7 +69,7 @@ func runTestcase(testcase string) error {
if testcase == "http3" {
r := &http3.RoundTripper{
TLSClientConfig: tlsConf,
QuicConfig: quicConf,
QUICConfig: quicConf,
}
defer r.Close()
return downloadFiles(r, urls, false)