Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNetTransport ¶
func NewNetTransport(cfg *ClientConfig) *http.Transport
Types ¶
type Client ¶
func NewClient ¶
func NewClient(cfg *ClientConfig, netTransport http.RoundTripper) *Client
NewClient creates http-client with predifineted timeouts
type ClientConfig ¶
type ClientConfig struct { // Timeout specifies a time limit for requests made by this // Client. The timeout includes connection time, any // redirects, and reading the response body. The timer remains // running after Get, Head, Post, or Do return and will // interrupt reading of the Response.Body. // // A Timeout of zero means no timeout. Timeout time.Duration // Timeout is the maximum amount of time a dial will wait for // a connect to complete. If Deadline is also set, it may fail // earlier. DialerTimeout time.Duration // TLSHandshakeTimeout specifies the maximum amount of time waiting to // wait for a TLS handshake. Zero means no timeout. TLSHandshakeTimeout time.Duration // ExpectContinueTimeout, if non-zero, specifies the amount of // time to wait for a server's first response headers after fully // writing the request headers if the request has an // "Expect: 100-continue" header. Zero means no timeout and // causes the body to be sent immediately, without // waiting for the server to approve. // This time does not include the time to send the request header. ExpectContinueTimeout time.Duration // IdleConnTimeout is the maximum amount of time an idle // (keep-alive) connection will remain idle before closing // itself. // Zero means no limit. IdleConnTimeout time.Duration // ResponseHeaderTimeout, if non-zero, specifies the amount of // time to wait for a server's response headers after fully // writing the request (including its body, if any). This // time does not include the time to read the response body. ResponseHeaderTimeout time.Duration }
ClientConfig represents HTTP client configuration.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewPool ¶
func NewPool(clientCfg *ClientConfig, poolCfg *PoolConfig) *Pool
func (*Pool) GetFromPool ¶
type PoolConfig ¶
type PoolConfig struct { // Size - size of pool httpclients Size int }
func (*PoolConfig) Initilize ¶
func (pc *PoolConfig) Initilize() error
Click to show internal directories.
Click to hide internal directories.