proxypool

package module
v0.0.0-...-ae61a8d Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2016 License: MIT Imports: 8 Imported by: 0

README

proxypool

GoDoc Build Status Coverage Status

A HTTP Proxy management suite written in golang.

Installation

To install this package, you need to install Go 1.4 or above and setup your Go workspace on your computer. The simplest way to install the library is to run:

$ go get github.com/willings/proxypool

Prerequisites

This requires Go 1.4 or above.

Usage

You can integrate this package into your own application or run it as a standalone process (T.B.D)

Documentation

See API documentation for package and API descriptions and find examples in the examples directory.

Status

Alpha release

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptAll

type AcceptAll struct {
}

func (*AcceptAll) Accept

func (filter *AcceptAll) Accept(info *ProxyInfo) bool

type AcceptOnlyAnnoymous

type AcceptOnlyAnnoymous struct {
}

func (*AcceptOnlyAnnoymous) Accept

func (filter *AcceptOnlyAnnoymous) Accept(info *ProxyInfo) bool

type Config

type Config struct {
	Validator        ValidateFunc
	ValidateInterval int

	Filter Filter

	Provider       provider.ProxyProvider
	ReloadInterval int

	ProxyStrategy ProxyStrategy
	AllowDirect   bool
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig() *Config

type Filter

type Filter interface {
	Accept(info *ProxyInfo) bool
}

type Protocol

type Protocol int
const (
	HTTP  Protocol = 1
	HTTPS Protocol = 2
)

type Proxy

type Proxy func(*http.Request) (*url.URL, error)

type ProxyInfo

type ProxyInfo struct {
	Host      string
	Port      int
	Type      Protocol
	Anonymous bool
}

func (*ProxyInfo) GetProxy

func (info *ProxyInfo) GetProxy() Proxy

type ProxyPool

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

func NewWithCsv

func NewWithCsv(csvFilePath string, config *Config) (*ProxyPool, error)

func (*ProxyPool) Add

func (pool *ProxyPool) Add(info ProxyInfo)

func (*ProxyPool) AutoProxy

func (pool *ProxyPool) AutoProxy() Proxy

func (*ProxyPool) Count

func (pool *ProxyPool) Count() int

func (*ProxyPool) Feedback

func (pool *ProxyPool) Feedback(proxy ProxyInfo, success bool, q *ProxyQuality)

func (*ProxyPool) GetAllFixedProxy

func (pool *ProxyPool) GetAllFixedProxy() []*ProxyInfo

func (*ProxyPool) GetProxy

func (pool *ProxyPool) GetProxy(requestURL *url.URL) *ProxyInfo

func (*ProxyPool) GetProxyState

func (pool *ProxyPool) GetProxyState(info ProxyInfo) *ProxyState

func (*ProxyPool) IsAvailable

func (pool *ProxyPool) IsAvailable() bool

func (*ProxyPool) Reload

func (pool *ProxyPool) Reload()

func (*ProxyPool) Save

func (pool *ProxyPool) Save()

type ProxyQuality

type ProxyQuality struct {
	ConnectTime   int
	DownloadSpeed int
}

type ProxyState

type ProxyState struct {
	InsertTime time.Time
	ActiveTime time.Time

	SuccessCnt int
	FailCnt    int

	Quality ProxyQuality
	AvgQ    ProxyQuality
}

type ProxyStrategy

type ProxyStrategy func(map[ProxyInfo]ProxyState, *http.Request) *ProxyInfo

TODO modifiable in outer package

type ValidateFunc

type ValidateFunc func(ProxyInfo) (*ProxyQuality, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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