func init()

in pkg/middleware/default_http_client.go [41:69]


func init() {
	defaultTransport = &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		}).DialContext,
		ForceAttemptHTTP2:     true,
		MaxIdleConns:          100,
		MaxIdleConnsPerHost:   100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}
	// We call configureHttp2TransportPing() in the package init to ensure that our defaultTransport is always configured
	// with the http2 additional settings that work around the issue described here:
	// https://github.com/golang/go/issues/59690
	// azure sdk related issue is here:
	// https://github.com/Azure/azure-sdk-for-go/issues/21346#issuecomment-1699665586
	configureHttp2TransportPing(defaultTransport)
	defaultRoundTripper = defaultTransport

	defaultHTTPClient = &http.Client{
		Transport: otelhttp.NewTransport(
			defaultRoundTripper,
			otelhttp.WithPropagators(propagation.TraceContext{}),
		),
	}
}