Documentation
¶
Overview ¶
Package ldhttp provides internal helper functions for custom HTTP configuration.
Applications will not normally need to use this package. Use the HTTP configuration options provided by ldcomponents.HTTPConfiguration() instead.
Index ¶
- func NewHTTPTransport(options ...TransportOption) (*http.Transport, *net.Dialer, error)
- type TransportOption
- func CACertFileOption(filePath string) TransportOption
- func CACertOption(certData []byte) TransportOption
- func ConnectTimeoutOption(timeout time.Duration) TransportOption
- func DisableKeepAlivesOption(disable bool) TransportOption
- func IdleConnTimeoutOption(timeout time.Duration) TransportOption
- func MaxIdleConnsOption(count int) TransportOption
- func MaxIdleConnsPerHostOption(count int) TransportOption
- func ProxyOption(url url.URL) TransportOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPTransport ¶
NewHTTPTransport creates a customized http.Transport struct using the specified options. It returns both the Transport and an associated net.Dialer.
To configure the LaunchDarkly SDK, rather than calling this function directly, it is simpler to use the methods provided by ldcomponents.HTTPConfiguration().
Types ¶
type TransportOption ¶
type TransportOption interface {
// contains filtered or unexported methods
}
TransportOption is the interface for optional configuration parameters that can be passed to NewHTTPTransport.
func CACertFileOption ¶
func CACertFileOption(filePath string) TransportOption
CACertFileOption specifies a CA certificate to be added to the trusted root CA list for HTTPS requests, when used with NewHTTPTransport. It reads the certificate data from a file in PEM format.
func CACertOption ¶
func CACertOption(certData []byte) TransportOption
CACertOption specifies a CA certificate to be added to the trusted root CA list for HTTPS requests, when used with NewHTTPTransport.
func ConnectTimeoutOption ¶
func ConnectTimeoutOption(timeout time.Duration) TransportOption
ConnectTimeoutOption specifies the maximum time to wait for a TCP connection, when used with NewHTTPTransport.
func DisableKeepAlivesOption ¶ added in v7.14.0
func DisableKeepAlivesOption(disable bool) TransportOption
DisableKeepAlivesOption disables HTTP keep-alives when set to true, when used with NewHTTPTransport.
func IdleConnTimeoutOption ¶ added in v7.14.0
func IdleConnTimeoutOption(timeout time.Duration) TransportOption
IdleConnTimeoutOption specifies the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself, when used with NewHTTPTransport.
func MaxIdleConnsOption ¶ added in v7.14.0
func MaxIdleConnsOption(count int) TransportOption
MaxIdleConnsOption specifies the maximum number of idle (keep-alive) connections across all hosts, when used with NewHTTPTransport.
func MaxIdleConnsPerHostOption ¶ added in v7.14.0
func MaxIdleConnsPerHostOption(count int) TransportOption
MaxIdleConnsPerHostOption specifies the maximum number of idle (keep-alive) connections per host, when used with NewHTTPTransport.
func ProxyOption ¶
func ProxyOption(url url.URL) TransportOption
ProxyOption specifies a proxy URL to be used for all requests, when used with NewHTTPTransport. This overrides any setting of the HTTP_PROXY, HTTPS_PROXY, or NO_PROXY environment variables.