Documentation
¶
Overview ¶
Package tlsconfig provides shared TLS configuration for HTTP clients.
Index ¶
Constants ¶
View Source
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the default timeout for HTTP clients.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClient ¶
NewHTTPClient creates an http.Client with the specified TLS configuration and the default timeout of 30 seconds.
Types ¶
type Config ¶
type Config struct {
// Insecure disables TLS certificate verification.
// NOT RECOMMENDED FOR PRODUCTION USE.
Insecure bool
// CACertFile is path to a PEM file containing trusted CA certificates.
// If empty, system CA certificates are used.
CACertFile string
}
Config holds TLS configuration options for HTTP clients.
func (Config) ValidateURL ¶
ValidateURL checks if a URL is allowed given this TLS configuration. Returns an error if the URL uses http:// without insecure mode enabled.
Click to show internal directories.
Click to hide internal directories.