hp

package
v0.0.0-...-61c5fd2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultClient    *http.Client // 30s timeout forbidden redirect
	DefaultTransport *http.Transport
)
View Source
var (
	RedisPool *redis.Pool
	ErrNil    = redis.ErrNil
)

Functions

func CloneDefaultClient

func CloneDefaultClient() *http.Client

func CloneDefaultTransport

func CloneDefaultTransport() *http.Transport

func GetProxyClient

func GetProxyClient(addr string) *http.Client

func GetRedisConnPool

func GetRedisConnPool(addr, password string, initDb, maxActive int) (pool *redis.Pool)

得到一个redis连接池

func InitRedis

func InitRedis(addr, password string, initDB, maxActive int) *redis.Pool

Types

type Logger

type Logger interface {
	Print(...interface{})
	Printf(string, ...interface{})
	Println(...interface{})
}

type Proxy

type Proxy struct {
	Ip         string `json:"ip"`
	Port       string `json:"port"`
	UsedCount  int    `json:"used_count"`
	InsertTime string `json:"insert_time"`
}

func (Proxy) String

func (p Proxy) String() string

type ProxyConn

type ProxyConn struct {
	redis.Conn
	Name string
}

func (*ProxyConn) RPopProxy

func (p *ProxyConn) RPopProxy() (proxy Proxy, err error)

func (*ProxyConn) RPushProxy

func (p *ProxyConn) RPushProxy(proxy Proxy)

type RedisAdapterClient

type RedisAdapterClient struct {
	Client *http.Client
	Name   string
	// contains filtered or unexported fields
}

func NewRedisAdapter

func NewRedisAdapter(name string, logger Logger) (*RedisAdapterClient, error)

func (*RedisAdapterClient) Reset

func (rac *RedisAdapterClient) Reset() error

Jump to

Keyboard shortcuts

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