Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidHeader is returned when there is an error while parsing the header line. ErrInvalidHeader = errors.New("invalid header line") // ErrInvalidProtocol is returned when there is an error while parsing the protocol. ErrInvalidProtocol = errors.New("invalid protocol") // ErrInvalidStatusCode is returned when there is an error while parsing the status code. ErrInvalidStatusCode = errors.New("invalid status code") // ErrInvalidStatusLine is returned when there is an error while parsing the status line. ErrInvalidStatusLine = errors.New("invalid status line") // ErrInvalidGZIP is returned when there is an error while reading a gzipped response body. ErrInvalidGZIP = errors.New("invalid gzip encoding") )
Functions ¶
func NewPool ¶
NewPool is a constructor function that creates a new collection of Pooled clients, on top of a new Client with the given Opt.
The pool is a buffered channel that can hold up to [size] clients. If the pool is full, it will wait until a client is available. Use it to limit the number of clients that can be created, and thus the total amount of ongoing requests and open connections.
Take a look at [pool_test.go] for usage examples.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a custom implementation of an HTTP client that can be used to perform HTTP requests.
type NetError ¶
type NetError string
NetError represents a network error.
func (*NetError) GobDecode ¶
GobDecode decodes the error from a byte slice. Implements the gob.GobDecoder interface.
type Opt ¶
type Opt func(*Client)
Opt is a functional option for the Client.
func WithProxyAddr ¶
WithProxyAddr is an option that sets the proxy address.
func WithProxyAuth ¶
WithProxyAuth is an option that sets the proxy authentication.