Versions in this module Expand all Collapse all v0 v0.0.2 Jul 12, 2024 Changes in this version type Client + func (obj *Client) Get(href string, options ...RequestOption) (resp *Response, err error) type Response + func Get(href string, options ...RequestOption) (resp *Response, err error) + func Request(method string, href string, options ...RequestOption) (resp *Response, err error) + func RequestWithContext(preCtx context.Context, method string, href string, options ...RequestOption) (resp *Response, err error) v0.0.1 May 31, 2023 v0.0.0 May 31, 2023 Changes in this version + var AcceptLanguage = `"zh-CN,zh;q=0.9"` + var ErrFatal = errors.New("致命错误") + var UserAgent = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36` + type AddrType int + const Auto + const Ipv4 + const Ipv6 + type Client struct + AfterCallBack func(context.Context, *Response) error + BeforCallBack func(context.Context, *RequestOption) error + DisDecode bool + DisRead bool + DisUnZip bool + ErrCallBack func(context.Context, error) bool + Headers any + RedirectNum int + Timeout int64 + TryNum int64 + func NewClient(clientOptinos ...ClientOption) (*Client, error) + func NewClientWithContext(preCtx context.Context, clientOptinos ...ClientOption) (*Client, error) + func (obj *Client) ClearCookies() error + func (obj *Client) Clone() *Client + func (obj *Client) Close() + func (obj *Client) CloseIdleConnections() + func (obj *Client) Closed() bool + func (obj *Client) Cookies(href string, cookies ...*http.Cookie) Cookies + func (obj *Client) GET(href string, options ...RequestOption) (resp *Response, err error) + func (obj *Client) POST(href string, options ...RequestOption) (resp *Response, err error) + func (obj *Client) Request(method string, href string, options ...RequestOption) (resp *Response, err error) + func (obj *Client) RequestWithContext(preCtx context.Context, method string, href string, options ...RequestOption) (resp *Response, err error) + func (obj *Client) Reset() error + type ClientOption struct + AddrType AddrType + DisAlive bool + DisCompression bool + DisCookie bool + DisDnsCache bool + Dns string + DnsCacheTime int64 + GetAddrType func(string) AddrType + GetProxy func(ctx context.Context, url *url.URL) (string, error) + H2Ja3 bool + H2Ja3Spec ja3.H2Ja3Spec + IdleConnTimeout int64 + Ja3 bool + Ja3Spec ja3.ClientHelloSpec + KeepAlive int64 + LocalAddr string + Proxy string + ResponseHeaderTimeout int64 + TLSHandshakeTimeout int64 + type Cookies []*http.Cookie + func ReadCookies(val any) Cookies + func ReadSetCookies(val any) Cookies + func (obj Cookies) Get(name string) *http.Cookie + func (obj Cookies) GetVal(name string) string + func (obj Cookies) GetVals(name string) []string + func (obj Cookies) Gets(name string) Cookies + func (obj Cookies) String() string + type DialClient struct + func NewDail(option DialOption) (*DialClient, error) + func (obj *DialClient) AddrToIp(ctx context.Context, addr string) (string, error) + func (obj *DialClient) DialContext(ctx context.Context, netword string, addr string) (net.Conn, error) + func (obj *DialClient) DialContextForProxy(ctx context.Context, netword string, scheme string, addr string, host string, ...) (net.Conn, error) + func (obj *DialClient) DialTlsProxyContext(ctx context.Context, netword string, addr string, host string) (net.Conn, error) + func (obj *DialClient) DnsDialContext(ctx context.Context, netword string, addr string) (net.Conn, error) + func (obj *DialClient) GetProxy(ctx context.Context, url *url.URL) (*url.URL, error) + func (obj *DialClient) Http2HttpProxy(ctx context.Context, network string, proxyUrl *url.URL) (conn net.Conn, err error) + func (obj *DialClient) Http2HttpsProxy(ctx context.Context, network string, addr string, host string, ...) (conn net.Conn, err error) + func (obj *DialClient) Http2Socks5Proxy(ctx context.Context, network string, addr string, proxyUrl *url.URL) (conn net.Conn, err error) + func (obj *DialClient) Https2HttpProxy(ctx context.Context, network string, addr string, host string, ...) (conn net.Conn, err error) + func (obj *DialClient) Https2HttpsProxy(ctx context.Context, network string, addr string, host string, ...) (conn net.Conn, err error) + func (obj *DialClient) Https2Socks5Proxy(ctx context.Context, network string, addr string, host string, ...) (conn net.Conn, err error) + type DialOption struct + AddrType AddrType + DisDnsCache bool + Dns string + DnsCacheTime int64 + GetAddrType func(string) AddrType + GetProxy func(ctx context.Context, url *url.URL) (string, error) + Ja3 bool + Ja3Spec ja3.ClientHelloSpec + KeepAlive int64 + LocalAddr string + Proxy string + TLSHandshakeTimeout int64 + type Event struct + Comment string + Data string + Event string + Id string + Retry int + type File struct + Content []byte + Key string + Name string + Type string + type RequestOption struct + AfterCallBack func(context.Context, *Response) error + BeforCallBack func(context.Context, *RequestOption) error + Body io.Reader + Cookies any + Data any + DisAlive bool + DisCookie bool + DisDecode bool + DisProxy bool + DisRead bool + DisUnZip bool + ErrCallBack func(context.Context, error) bool + Files []File + Form any + Headers any + Host string + Ja3 bool + Ja3Spec ja3.ClientHelloSpec + Json any + Method string + Params any + Proxy string + Raw any + RedirectNum int + TempData any + Text any + Timeout int64 + TryNum int64 + Url *url.URL + WsOption websocket.Option + type Response struct + func (obj *Response) Close() error + func (obj *Response) Content(val ...[]byte) []byte + func (obj *Response) ContentEncoding() string + func (obj *Response) ContentLength() int64 + func (obj *Response) ContentType() string + func (obj *Response) Cookies() Cookies + func (obj *Response) Decode(encoding string) + func (obj *Response) Headers() http.Header + func (obj *Response) Html() *bs4.Client + func (obj *Response) Json(path ...string) gjson.Result + func (obj *Response) Location() (*url.URL, error) + func (obj *Response) Map() map[string]any + func (obj *Response) Read(con []byte) (int, error) + func (obj *Response) Response() *http.Response + func (obj *Response) SseClient() *SseClient + func (obj *Response) Status() string + func (obj *Response) StatusCode() int + func (obj *Response) Text(val ...string) string + func (obj *Response) Url() *url.URL + func (obj *Response) WebSocket() *websocket.Conn + type SseClient struct + func (obj *SseClient) Recv() (Event, error)