httpclient

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProxyURLs

func GetProxyURLs(opt *ProxyOption) ([]string, error)

func PostFile

func PostFile(url, form_name, file_name, path string) (res *http.Response, err error)

通过HTTP上传文件 模拟<form ...><input name="file" type="file" />...</form> 参数说明 url: 上传服务器URL form_name: 对应<input>标签中的name file_name: 为form表单中的文件名 path: 为实际要上传的本地文件路径

Types

type Addr

type Addr struct {
	IP   string `json:"ip"`
	Port int    `json:"port"`
}

Use IPProxys: (https://github.com/black-tech/IPProxyPool)

func (*Addr) ToURL

func (a *Addr) ToURL(isHttps bool) string

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func NewProxyClient

func NewProxyClient(proxyURL string) (*Client, error)

func (*Client) IsExists

func (cli *Client) IsExists(Url string) bool

func (*Client) PostFile

func (cli *Client) PostFile(Url string, formName string, f *os.File) (*http.Response, error)

func (*Client) PostJSON

func (cli *Client) PostJSON(Url string, data interface{}) (*http.Response, error)

type CookieMap

type CookieMap map[string]*http.Cookie

func (CookieMap) GetValue

func (c CookieMap) GetValue(key string) string

type Jar

type Jar struct {
	// contains filtered or unexported fields
}

func (*Jar) Cookies

func (jar *Jar) Cookies(u *url.URL) []*http.Cookie

func (*Jar) SetCookies

func (jar *Jar) SetCookies(u *url.URL, cookies []*http.Cookie)

type ProxyOption

type ProxyOption struct {
	PoolURL     string
	Transparent bool // 透明,否则高匿
	UseHttps    bool
	Count       int
	Country     string
	Area        string
}

func (*ProxyOption) String

func (opt *ProxyOption) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL