proxy_pool

package
v0.0.0-...-766f18e Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoProxyGetter

type AutoProxyGetter interface {
	ProxyPool
	proxy_crawler.Crawler
}

type DefaultAutoProxyGetter

type DefaultAutoProxyGetter struct {
	ProxyPool
	proxy_crawler.Crawler
}

type DefaultProxyPool

type DefaultProxyPool struct {
	CheckBeforeGetProxy bool // if true, proxy will be checked for availability before returning; otherwise, it will be returned directly
	// contains filtered or unexported fields
}

func (*DefaultProxyPool) CheckExist

func (p *DefaultProxyPool) CheckExist(proxyAddr string) bool

func (*DefaultProxyPool) CheckProxy

func (p *DefaultProxyPool) CheckProxy(proxyAddr string) bool

func (*DefaultProxyPool) EraseProxy

func (p *DefaultProxyPool) EraseProxy(proxy string) int

The efficiency is not high when the number of proxies is large

func (*DefaultProxyPool) GetProxy

func (p *DefaultProxyPool) GetProxy() (string, error)

func (*DefaultProxyPool) LenOfProxies

func (p *DefaultProxyPool) LenOfProxies() int

func (*DefaultProxyPool) PushProxy

func (p *DefaultProxyPool) PushProxy(proxy ...string)

type ProxyPool

type ProxyPool interface {
	GetProxy() (string, error)    // return an usable proxy. if there is not an usable proxy, return "", error
	CheckProxy(proxy string) bool // check if the proxy is usable
	EraseProxy(proxy string) int  // erase the proxy from the proxy list
	PushProxy(proxy ...string)    // push the proxy into the proxy list
	LenOfProxies() int
}

type WithThresholdDecorator

type WithThresholdDecorator struct {
	AutoProxyGetter
	// contains filtered or unexported fields
}

func WrapWithThresholdDecorator

func WrapWithThresholdDecorator(a AutoProxyGetter, threshold int) *WithThresholdDecorator

WrapWithThresholdDecorator 达到阈值时爬取代理ip

type WithTimeDecorator

type WithTimeDecorator struct {
	AutoProxyGetter
	// contains filtered or unexported fields
}

func WrapWithTimeDecorator

func WrapWithTimeDecorator(a AutoProxyGetter, interval int) *WithTimeDecorator

WrapWithTimeDecorator 周期性爬取代理ip

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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