transport

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrIdle

func NewOrIdle(tlsConfig *tls.Config) *http.Transport

NewOrIdle tries to return an existing transport that is not currently being used. If none is found, creates a new Transport instead.

tlsConfig can optionally set the TLSClientConfig for the transport.

func Release

func Release(transport *http.Transport) error

Release releases the transport back to the TransportPool after sanitising its sensitive fields.

Types

type TransportPool

type TransportPool struct {
}

TransportPool is a progressive and non-blocking pool for http.Transport objects, optimised for Gargabe Collection and without a hard limit on number of objects created.

Its main purpose is to enable for transport objects to be used across helm chart download requests and helm/pkg/getter instances by leveraging the getter.WithTransport(t) construct.

The use of this pool improves the default behaviour of helm getter which creates a new connection per request, or per getter instance, resulting on unnecessary TCP connections with the target.

http.Transport objects may contain sensitive material and also have settings that may impact the security of HTTP operations using them (i.e. InsecureSkipVerify). Therefore, ensure that they are used in a thread-safe way, and also by reseting TLS specific state after each use.

Calling the Release(t) function will reset TLS specific state whilst also releasing the transport back to the pool to be reused.

xref: https://github.com/helm/helm/pull/10568 xref2: https://github.com/fluxcd/source-controller/issues/578

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL