Documentation ¶
Index ¶
- func NewBearerTokenFileRoundTripper(bearerFile string, rt http.RoundTripper) http.RoundTripper
- func NewBearerTokenRoundTripper(token string, rt http.RoundTripper) http.RoundTripper
- func NewClient(cfg ClientConfig) (*http.Client, error)
- func NewRoundTripper(cfg ClientConfig) (http.RoundTripper, error)
- func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error)
- type ClientConfig
- type TLSConfig
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBearerTokenFileRoundTripper ¶
func NewBearerTokenFileRoundTripper(bearerFile string, rt http.RoundTripper) http.RoundTripper
Returns a new HTTP RoundTripper that adds the bearer token from the given file to a request header
func NewBearerTokenRoundTripper ¶
func NewBearerTokenRoundTripper(token string, rt http.RoundTripper) http.RoundTripper
Returns a new HTTP RoundTripper that adds the given bearer token to a request header
func NewClient ¶
func NewClient(cfg ClientConfig) (*http.Client, error)
Returns a new HTTP client based on the given configuration.
func NewRoundTripper ¶
func NewRoundTripper(cfg ClientConfig) (http.RoundTripper, error)
Returns a new HTTP RoundTripper based on the given configuration.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // The bearer token for the client. Either this or the file below should be provided. BearerToken string `yaml:"bearer_token,omitempty"` // The bearer token file for the client. Either this or the token above should be provided. BearerTokenFile string `yaml:"bearer_token_file,omitempty"` // HTTP proxy server to use to connect. ProxyURL URL `yaml:"proxy_url,omitempty"` // TLSConfig to use to connect. TLSConfig TLSConfig `yaml:"tls_config,omitempty"` }
The configuration for a HTTP client.
func FromYAML ¶
func FromYAML(contents []byte) (ClientConfig, error)
FromYAML loads the configuration from a blob of YAML.
type TLSConfig ¶
type TLSConfig struct { // The CA cert. CAFile string `yaml:"ca_file,omitempty"` // The client cert file. CertFile string `yaml:"cert_file,omitempty"` // The client key file. KeyFile string `yaml:"key_file,omitempty"` // Used to verify the hostname for the targets. ServerName string `yaml:"server_name,omitempty"` // Disables certificate validation. InsecureSkipVerify bool `yaml:"insecure_skip_verify"` }
The TLS configuration for a HTTP client.
Click to show internal directories.
Click to hide internal directories.