Documentation ¶
Index ¶
- func DELETE(u string, opts ...Option) (raw json.RawMessage, err error)
- func Dir() string
- func File(u, method string, opts ...Option) (io io.Reader, err error)
- func GET(u string, opts ...Option) (raw json.RawMessage, err error)
- func GetCookie(url *url.URL, name string) *http.Cookie
- func Hash(key, msg string) string
- func MD5(msg string) []byte
- func POST(u string, opts ...Option) (raw json.RawMessage, err error)
- func PUT(u string, opts ...Option) (raw json.RawMessage, err error)
- func ReadFile(filepath string, data interface{}) error
- func RegisterConnTimeout(timeout, longTimeout time.Duration)
- func RegisterCookieFun(name string)
- func RegisterCookieJar(name string)
- func RegisterDNS(dns []string)
- func RegisterDNSTimeout(timeout time.Duration)
- func RegisterDialerTimeout(timeout time.Duration)
- func RegisterProxy(proxy func(*http.Request) (*url.URL, error))
- func Request(method, u string, opts ...Option) (json.RawMessage, http.Header, error)
- func Sha256(msg string) string
- func UserAgent(args ...int) string
- func WriteFile(filepath string, data interface{}) error
- type ClientOption
- func WithClientCookieFun(name string) ClientOption
- func WithClientCookieJar(name string) ClientOption
- func WithClientDNS(dns []string) ClientOption
- func WithClientProxy(proxy func(*http.Request) (*url.URL, error)) ClientOption
- func WithConnTimeout(timeout, longTimeout time.Duration) ClientOption
- func WithDNSTimeout(timeout time.Duration) ClientOption
- func WithDialerTimeout(timeout time.Duration) ClientOption
- type CodeError
- type EmbedClient
- func (c *EmbedClient) DELETE(u string, opts ...Option) (raw json.RawMessage, err error)
- func (c *EmbedClient) File(u, method string, opts ...Option) (io io.Reader, err error)
- func (c *EmbedClient) GET(u string, opts ...Option) (raw json.RawMessage, err error)
- func (c *EmbedClient) GetCookie(url *url.URL, name string) *http.Cookie
- func (c *EmbedClient) GetCookies(url *url.URL) []*http.Cookie
- func (c *EmbedClient) POST(u string, opts ...Option) (raw json.RawMessage, err error)
- func (c *EmbedClient) PUT(u string, opts ...Option) (raw json.RawMessage, err error)
- func (c *EmbedClient) Request(method, u string, opts ...Option) (json.RawMessage, http.Header, error)
- type Group
- type Jar
- type Option
- func WithAfterResponse(f func(w *http.Response)) Option
- func WithBeforeRequest(f func(r *http.Request)) Option
- func WithBody(body interface{}) Option
- func WithContext(ctx context.Context) Option
- func WithDebug() Option
- func WithHeader(header map[string]string) Option
- func WithProxy(f func(*http.Request) (*url.URL, error)) Option
- func WithRandomHost(f func(string) string) Option
- func WithRetry(retry uint) Option
- func WithTest() Option
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterConnTimeout ¶ added in v1.5.13
func RegisterCookieFun ¶ added in v1.5.11
func RegisterCookieFun(name string)
func RegisterCookieJar ¶ added in v1.5.11
func RegisterCookieJar(name string)
func RegisterDNS ¶ added in v1.3.7
func RegisterDNS(dns []string)
func RegisterDNSTimeout ¶ added in v1.5.13
func RegisterDialerTimeout ¶ added in v1.5.13
func RegisterProxy ¶ added in v1.5.5
Types ¶
type ClientOption ¶ added in v1.5.11
type ClientOption interface {
// contains filtered or unexported methods
}
func WithClientCookieFun ¶ added in v1.5.11
func WithClientCookieFun(name string) ClientOption
func WithClientCookieJar ¶ added in v1.5.11
func WithClientCookieJar(name string) ClientOption
func WithClientDNS ¶ added in v1.5.11
func WithClientDNS(dns []string) ClientOption
func WithClientProxy ¶ added in v1.5.11
func WithConnTimeout ¶ added in v1.5.13
func WithConnTimeout(timeout, longTimeout time.Duration) ClientOption
func WithDNSTimeout ¶ added in v1.5.13
func WithDNSTimeout(timeout time.Duration) ClientOption
func WithDialerTimeout ¶ added in v1.5.13
func WithDialerTimeout(timeout time.Duration) ClientOption
type EmbedClient ¶ added in v1.5.11
func NewClient ¶ added in v1.5.11
func NewClient(opts ...ClientOption) *EmbedClient
func (*EmbedClient) DELETE ¶ added in v1.5.11
func (c *EmbedClient) DELETE(u string, opts ...Option) (raw json.RawMessage, err error)
func (*EmbedClient) GET ¶ added in v1.5.11
func (c *EmbedClient) GET(u string, opts ...Option) (raw json.RawMessage, err error)
func (*EmbedClient) GetCookies ¶ added in v1.5.13
func (c *EmbedClient) GetCookies(url *url.URL) []*http.Cookie
func (*EmbedClient) POST ¶ added in v1.5.11
func (c *EmbedClient) POST(u string, opts ...Option) (raw json.RawMessage, err error)
func (*EmbedClient) PUT ¶ added in v1.5.11
func (c *EmbedClient) PUT(u string, opts ...Option) (raw json.RawMessage, err error)
func (*EmbedClient) Request ¶ added in v1.5.11
func (c *EmbedClient) Request(method, u string, opts ...Option) (json.RawMessage, http.Header, error)
type Group ¶ added in v1.3.0
type Group struct {
// contains filtered or unexported fields
}
Group represents a class of work and forms a namespace in which units of work can be executed with duplicate suppression.
func (*Group) Do ¶ added in v1.3.0
func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool)
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in, the duplicate caller waits for the original to complete and receives the same results. The return value shared indicates whether v was given to multiple callers.
type Jar ¶
type Jar struct { PsList cookiejar.PublicSuffixList `json:"pslist"` // mu locks the remaining fields. Mu sync.Mutex `json:"mu"` // entries is a set of entries, keyed by their eTLD+1 and subkeyed by // their name/domain/path. Entries map[string]map[string]entry `json:"entries"` // nextSeqNum is the next sequence number assigned to a new cookie // created SetCookies. NextSeqNum uint64 `json:"nextseqnum"` }
type Option ¶ added in v1.5.0
type Option interface {
// contains filtered or unexported methods
}
func WithAfterResponse ¶ added in v1.5.0
func WithBeforeRequest ¶ added in v1.5.0
func WithContext ¶ added in v1.5.0
func WithHeader ¶ added in v1.5.0
func WithRandomHost ¶ added in v1.5.8
Click to show internal directories.
Click to hide internal directories.