Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
ProxyIP string // IP:端口
Protocol string // 协议类型,如HTTP
Status string // 状态,如Online
Country string // 国家代码,如de
}
Proxy 表示一个代理服务器信息
type ProxyScrape ¶
type ProxyScrape struct {
// contains filtered or unexported fields
}
ProxyScrape 代理抓取器,负责维护代理列表并提供相关操作
func NewProxyScrape ¶
func NewProxyScrape(auth, ip, ipU, ipW string) *ProxyScrape
NewProxyScrape 创建一个新的代理抓取器 auth: API_KEY认证信息 ip: 提供一个HTTP代理IP:端口,用于访问接口(中国大陆可能无法直接访问接口,如需本地调试,可传入代理IP) ipU:代理IP用户名 ipP:代理IP密码
func (*ProxyScrape) GetAllProxies ¶
func (ps *ProxyScrape) GetAllProxies(protocol string) []Proxy
GetAllProxies 获取指定协议类型的全部代理IP protocol: 必选参数,指定协议类型,"http"或"socks" 返回值: (代理列表, 是否成功)
func (*ProxyScrape) GetRandomProxy ¶
func (ps *ProxyScrape) GetRandomProxy(country string, protocol string) Proxy
GetRandomProxy 获取随机代理IP country: 可选参数,国家代码或多个逗号分隔的国家代码,如"de"或"de,fr" protocol: 必选参数,指定协议类型,"http"或"socks" 返回值: 代理信息
Click to show internal directories.
Click to hide internal directories.