Documentation ¶
Index ¶
- Constants
- Variables
- func AssetGetContent(fp string) []byte
- func GetVersion() string
- func InitConf(confDir string)
- func ReduceHTMLSpace(html string) string
- func SetInterval(call func(), dur time.Duration) *time.Ticker
- func StrMd5(str string) string
- type Config
- type GroupNumbers
- type Proxy
- type ProxyList
- func (pl *ProxyList) Add(p *Proxy) bool
- func (pl *ProxyList) Get(key string) *Proxy
- func (pl *ProxyList) MergeTo(to *ProxyList)
- func (pl *ProxyList) Next() *Proxy
- func (pl *ProxyList) Range(fn func(proxyURL string, proxy *Proxy) bool)
- func (pl *ProxyList) Remove(key string) bool
- func (pl *ProxyList) String() string
- func (pl *ProxyList) Total() int
- type ProxyManager
- type ProxyPool
- type User
Constants ¶
View Source
const ( // AuthTypeNO 不需要认证 AuthTypeNO = "no" // AuthTypeBasic 使用basic AuthTypeBasic = "basic" // AuthTypeBasicWithAny 使用basic,任意账号密码都可以 AuthTypeBasicWithAny = "basic_any" )
Variables ¶
View Source
var ProxyDebug = os.Getenv("ProxyManagerDebug") == "true"
ProxyDebug 是否debug
Functions ¶
func AssetGetContent ¶
func GetVersion ¶
func GetVersion() string
Types ¶
type Config ¶
type Config struct { Title string Notice string AliveCheckURL string // 必填,通过检测这个url来判断代理是否正常 AuthType string // 可选,鉴权类型,可选值 no-不需要鉴权,basic、basic_any-任意帐号 WrongStatusCode []int Port int // 必填,服务端口 Timeout int // 可选,超时时间,单位秒,默认 30 ReTry int // 可选,重试次数,默认 2 ReTryMax int // 可选,最大重试次数由客户端通过http header [X-Man-Retry]指定 CheckInterval int // 可选,检测代理有效的间隔时间,单位秒,默认 1800 }
func (*Config) IsWrongCode ¶
type GroupNumbers ¶
func (GroupNumbers) Add ¶
func (c GroupNumbers) Add(item string, n int)
func (GroupNumbers) Get ¶
func (c GroupNumbers) Get(item string) int
type Proxy ¶
type Proxy struct { LastCheck time.Time LastCheckOk time.Time URL *url.URL Count *proxyCount Weight int StatusCode proxyStatus CheckUsed time.Duration // Used int64 // contains filtered or unexported fields }
Proxy 一个代理
type ProxyManager ¶
type ProxyManager struct {
// contains filtered or unexported fields
}
ProxyManager manager server
func NewProxyManager ¶
func NewProxyManager(configPath string) *ProxyManager
NewProxyManager init server
func (*ProxyManager) ServeHTTP ¶
func (man *ProxyManager) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*ProxyManager) Start ¶
func (man *ProxyManager) Start()
type ProxyPool ¶
type ProxyPool struct { Count *proxyCount // contains filtered or unexported fields }
ProxyPool 代理池
func (*ProxyPool) ActiveList ¶
func (*ProxyPool) GetProxyNumbers ¶
func (p *ProxyPool) GetProxyNumbers() GroupNumbers
GetProxyNumbers 返回各种代理的数量 web页面会使用
Click to show internal directories.
Click to hide internal directories.