Documentation
¶
Index ¶
- Constants
- Variables
- func IsConnectionErr(err error) bool
- func IsTimeoutErr(err error) bool
- type PostHandler
- type PreHandler
- type ProxyPool
- func (p *ProxyPool) Close()
- func (p *ProxyPool) Dirty(item *url.URL, wait time.Duration)
- func (p *ProxyPool) Do(req *http.Request) (resp *http.Response, err error)
- func (p *ProxyPool) NewClient() (cli *http.Client, purl *url.URL, err error)
- func (p *ProxyPool) ProxyURL() (*url.URL, error)
- func (p *ProxyPool) WithPostHandle(hdls ...PostHandler) *ProxyPool
- func (p *ProxyPool) WithPreHandle(hdls ...PreHandler) *ProxyPool
- func (p *ProxyPool) WithRetryTimes(times int) *ProxyPool
- func (p *ProxyPool) WithTimeout(timeout time.Duration) *ProxyPool
- func (p *ProxyPool) WithWaitInterval(interval time.Duration) *ProxyPool
- type ProxyPoolOption
Constants ¶
View Source
const ( ProxyPoolOptionCountry_domestic = "国内" ProxyPoolOptionCountry_foreign = "国外" )
View Source
const ( DefaultMaxRetryTimes = 3 DefaultHTTPTimeout = time.Second * 5 DefaultWaitInterval = time.Second * 15 )
Variables ¶
View Source
var ( ErrFirewallDeny = errors.New("proxypool: Firewall denied access") ErrTimeout = errors.New("proxypool: Connection timeout") ErrIllegalBody = errors.New("proxypool: Body contains illegal substr") ErrIllegalURL = errors.New("proxypool: URL contains illegal substr") ErrNotFound = errors.New("proxypool: Not found a useful proxy url") )
View Source
var (
DistantFuture = time.Hour * 24 * 365 * 100
)
Functions ¶
Types ¶
type PostHandler ¶
func WithBodyContains ¶
func WithBodyContains(substr string) PostHandler
func WithURLContains ¶
func WithURLContains(substr string) PostHandler
type PreHandler ¶
type ProxyPool ¶
func NewPool ¶
func NewPool(opt ProxyPoolOption) (*ProxyPool, error)
func (*ProxyPool) WithPostHandle ¶
func (p *ProxyPool) WithPostHandle(hdls ...PostHandler) *ProxyPool
func (*ProxyPool) WithPreHandle ¶
func (p *ProxyPool) WithPreHandle(hdls ...PreHandler) *ProxyPool
func (*ProxyPool) WithRetryTimes ¶
Click to show internal directories.
Click to hide internal directories.