Documentation ¶
Index ¶
Constants ¶
const ( DefaultMaxConns = 10240 DefaultMaxConnWaitTimeout = time.Second * 60 DefaultMaxRedirectCount = 2 )
Variables ¶
This section is empty.
Functions ¶
func DebugHandleFun ¶ added in v0.9.0
func DebugHandleFun(w http.ResponseWriter, r *http.Request)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements http client.
Copying Client by value is prohibited. Create new instance instead.
It is safe calling Client methods from concurrently running goroutines.
The fields of a Client should not be changed while it is in use.
func (*Client) ProxyTimeout ¶
func (c *Client) ProxyTimeout(addr string, req *fasthttp.Request, resp *fasthttp.Response, timeout time.Duration) error
ProxyTimeout performs the given request and waits for response during the given timeout duration.
Request must contain at least non-zero RequestURI with full url (including scheme and host) or non-zero Host header + RequestURI.
Client determines the server to be requested in the following order:
- from RequestURI if it contains full url with scheme and host;
- from Host header otherwise.
The function doesn't follow redirects. Use Get* for following redirects.
Response is ignored if resp is nil.
ErrTimeout is returned if the response wasn't returned during the given timeout.
ErrNoFreeConns is returned if all Client.MaxConnsPerHost connections to the requested host are busy.
It is recommended obtaining req and resp via AcquireRequest and AcquireResponse in performance-critical code.
Warning: ProxyTimeout does not terminate the request itself. The request will continue in the background and the response will be discarded. If requests take too long and the connection pool gets filled up please try setting a ReadTimeout.