Documentation
¶
Index ¶
- func NewHttpClient(c *HttpClientConfig, logger hclog.Logger, clientCerts []tls.Certificate) *http.Client
- func NewHttpTransport(c *HttpClientConfig, logger hclog.Logger, clientCerts []tls.Certificate) http.RoundTripper
- func NewLogTransport(transport *http.Transport, logger hclog.Logger) http.RoundTripper
- type HttpClientConfig
- type LogTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpClient ¶
func NewHttpClient(c *HttpClientConfig, logger hclog.Logger, clientCerts []tls.Certificate) *http.Client
func NewHttpTransport ¶
func NewHttpTransport(c *HttpClientConfig, logger hclog.Logger, clientCerts []tls.Certificate) http.RoundTripper
NewHttpClient Create new http.Transport initialize according to HttpClientConfig
func NewLogTransport ¶
func NewLogTransport(transport *http.Transport, logger hclog.Logger) http.RoundTripper
Types ¶
type HttpClientConfig ¶
type HttpClientConfig struct {
// MaxIdleConns controls the maximum number of idle (keep-alive)
// connections across all hosts. Zero means no limit.
MaxIdleConns int `yaml:"max_idle_conns" default:"10" `
// MaxIdleConnsPerHost, if non-zero, controls the maximum idle
// (keep-alive) connections to keep per-host. If zero,
// DefaultMaxIdleConnsPerHost is used.
MaxIdleConnsPerHost int `yaml:"max_idle_conns_per_host" default:"10" `
// Zero means no limit.
MaxConnsPerHost int `yaml:"max_conns_per_host" default:"10" `
// The Client cancels requests to the underlying Transport
// as if the Request's Context ended.
Timeout time.Duration `yaml:"timeout_duration" default:"10s"`
InsecureSkipVerify bool `yaml:"skip_tls_verification" default:"false"`
MaxRespSizeLimitBytes int64 `yaml:"limit_max_resp_size_limit" default:"60000"`
ExtraHeader map[string]string `yaml:"extra_headers"`
}
func NewDefaultHttpClientCfg ¶
func NewDefaultHttpClientCfg() *HttpClientConfig
NewDefaultHttpClientCfg create a default config
func (*HttpClientConfig) UnmarshalYAML ¶
func (c *HttpClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type LogTransport ¶
type LogTransport struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.