Documentation
¶
Index ¶
- Constants
- func NewIP66Proxy(interval time.Duration) *ip66Proxy
- func NewKuaiProxy(interval time.Duration) *kuaiProxy
- func NewProxyClient(p *Proxy) *http.Client
- func NewXiciProxy(interval time.Duration) *xiciProxy
- type Crawler
- type FetchListener
- type Proxy
- type ProxyCrawler
- type ProxyList
- func (pl *ProxyList) Add(list ...*Proxy)
- func (pl *ProxyList) Exists(p *Proxy) bool
- func (pl *ProxyList) FindOne(category string, speed int32) (p *Proxy)
- func (pl *ProxyList) List() []*Proxy
- func (pl *ProxyList) Remove(list ...*Proxy)
- func (pl *ProxyList) Replace(list []*Proxy)
- func (pl *ProxyList) Reset() []*Proxy
- func (pl *ProxyList) Size() int
Constants ¶
View Source
const ( StatusRunning = iota StatusStop )
View Source
const (
ProxyIP66 = "ip66"
)
View Source
const (
ProxyKuai = "kuai"
)
View Source
const (
ProxyXiCi = "xici"
)
Variables ¶
This section is empty.
Functions ¶
func NewIP66Proxy ¶
NewIP66Proxy create a new ip66 proxy crawler
func NewKuaiProxy ¶
NewKuaiProxy create a new kuai proxy crawler
func NewProxyClient ¶
NewProxyClient create a new http client with proxy
func NewXiciProxy ¶
NewXiciProxy create a new xici proxy crawler
Types ¶
type Crawler ¶
type Crawler struct {
sync.Mutex
HTTPDetectURL string
HTTPSDetectURL string
// contains filtered or unexported fields
}
Crawler crawler
func (*Crawler) GetAvailableProxy ¶
GetAvailableProxy get available proxy
func (*Crawler) GetAvailableProxyList ¶
GetAvailableProxyList get available proxy list
func (*Crawler) RedetectAvailableProxy ¶
func (c *Crawler) RedetectAvailableProxy()
RedetectAvailableProxy redetect available proxy
type Proxy ¶
type Proxy struct {
DetectedAt int64 `json:"detectedAt,omitempty"`
IP string `json:"ip,omitempty"`
Port string `json:"port,omitempty"`
Category string `json:"category,omitempty"`
Anonymous bool `json:"anonymous,omitempty"`
Speed int32 `json:"speed,omitempty"`
Fails int32 `json:"fails,omitempty"`
}
Proxy proxy server
type ProxyCrawler ¶
type ProxyCrawler interface {
// OnFetch set fetch listener
OnFetch(FetchListener)
// Start start the crawler
Start()
// Stop stop the crawler
Stop()
}
ProxyCrawler proxy crawler
Click to show internal directories.
Click to hide internal directories.