Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMaxRedirectsExceeded = errors.New("max redirects exceeded") ErrTimeoutExceeded = errors.New("timeout exceeded") )
Errors.
View Source
var DefaultClient = &http.Client{ CheckRedirect: checkRedirect, Timeout: 10 * time.Second, Transport: &http.Transport{ DisableCompression: true, Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 5 * time.Second, KeepAlive: 0, }).DialContext, DisableKeepAlives: true, MaxIdleConns: 10, TLSHandshakeTimeout: 5 * time.Second, }, }
DefaultClient used for requests.
View Source
var DefaultMaxRedirects = 5
DefaultMaxRedirects is the max number of redirects.
Functions ¶
Types ¶
type Response ¶
type Response interface { Status() int Redirects() int TLS() bool Header() http.Header HeaderSize() int BodySize() int TimeDNS() time.Duration TimeConnect() time.Duration TimeTLS() time.Duration TimeWait() time.Duration TimeResponse(time.Time) time.Duration TimeDownload(time.Time) time.Duration TimeTotal(time.Time) time.Duration TimeTotalWithRedirects(time.Time) time.Duration TimeRedirects() time.Duration Traces() []Trace Stats() *Stats }
Response interface.
type Stats ¶
type Stats struct { Status int `json:"status,omitempty"` Redirects int `json:"redirects,omitempty"` TLS bool `json:"tls"` Header http.Header `json:"header,omitempty"` HeaderSize int `json:"header_size,omitempty"` BodySize int `json:"body_size,omitempty"` TimeDNS time.Duration `json:"time_dns"` TimeConnect time.Duration `json:"time_connect"` TimeTLS time.Duration `json:"time_tls"` TimeWait time.Duration `json:"time_wait"` TimeResponse time.Duration `json:"time_response"` TimeDownload time.Duration `json:"time_download"` TimeTotal time.Duration `json:"time_total"` TimeTotalWithRedirects time.Duration `json:"time_total_with_redirects,omitempty"` TimeRedirects time.Duration `json:"time_redirects,omitempty"` Traces []*Stats `json:"traces,omitempty"` }
Stats is an opaque struct which can be useful for JSON marshaling.
type Trace ¶
type Trace interface { Address() string TLS() bool Start() time.Time TimeDNS() time.Duration TimeConnect() time.Duration TimeTLS() time.Duration TimeWait() time.Duration TimeResponse(time.Time) time.Duration TimeDownload(time.Time) time.Duration TimeTotal(time.Time) time.Duration Stats() *Stats }
Trace results.
Click to show internal directories.
Click to hide internal directories.