Documentation
¶
Index ¶
- Variables
- func CustomResolver(r *resolver.Resolver) func(ctx context.Context, network, addr string) ([]net.IPAddr, string, error)
- func GetHeaderByMap(h map[string]string) http.Header
- func RetryLengthTrigger(resp *http.Response) bool
- func RetryStatusTrigger(resp *http.Response) bool
- func SleepRand(min, max, step time.Duration) func(*http.Request) time.Duration
- type Client
- func (c *Client) Client() *http.Client
- func (c *Client) Delete(url string) Response
- func (c *Client) Do(request *http.Request) (resp Response)
- func (c *Client) Get(url string) Response
- func (c *Client) Head(url string) Response
- func (c *Client) NewRequest(method, link string, body io.Reader) *http.Request
- func (c *Client) Patch(url string, body io.Reader) Response
- func (c *Client) Post(url string, body io.Reader) Response
- func (c *Client) PostForm(url string, data url.Values) Response
- func (c *Client) PostJson(url string, j interface{}) (resp Response)
- func (c *Client) Put(url string, body io.Reader) Response
- type Config
- type Response
- func (r Response) Body() io.ReadCloser
- func (r Response) ContentLength() int64
- func (r Response) Error() error
- func (r Response) Header() http.Header
- func (r Response) ReadAll() []byte
- func (r Response) ReadJSON(i interface{}) error
- func (r Response) ReadLimit(n int64) []byte
- func (r Response) Request() *http.Request
- func (r Response) Response() *http.Response
- func (r Response) SaveBody(filename string) (int64, error)
- func (r Response) SaveHeader(filename string) error
- func (r Response) StatusCode() int
- func (r Response) TLS() *tls.ConnectionState
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CustomResolver ¶
func RetryLengthTrigger ¶
func RetryStatusTrigger ¶
Types ¶
type Client ¶
type Client struct {
Config *Config
// contains filtered or unexported fields
}
func (*Client) NewRequest ¶
type Config ¶
type Config struct {
BeforeFunc func(req *http.Request)
AfterFunc func(req *http.Request, resp Response)
SleepFunc func(req *http.Request) time.Duration
ResolveFunc func(ctx context.Context, network, addr string) (ips []net.IPAddr, port string, err error)
ProxyFunc func(req *http.Request) (*url.URL, error)
RedirectFunc func(req *http.Request, via []*http.Request) error
MaxRetryAttempts int
RetryDelay time.Duration
RetryTrigger func(resp *http.Response) bool
Header http.Header
FakeIP bool
InsecureSkipVerify bool
AutoReferrer bool
UseCookie bool
DisableKeepAlive bool
DisableCompression bool
MaxConnsPerHost int
MaxIdleConns int
MaxIdleConnsPerHost int
MaxResponseHeaderBytes int64
MaxRedirects int
Timeout time.Duration
KeepAlive time.Duration
WriteBufferSize int
ReadBufferSize int
CachePath string
}
type Response ¶
func (Response) Body ¶
func (r Response) Body() io.ReadCloser
func (Response) ContentLength ¶
func (Response) SaveHeader ¶
func (Response) StatusCode ¶
func (Response) TLS ¶
func (r Response) TLS() *tls.ConnectionState
Click to show internal directories.
Click to hide internal directories.