Documentation
¶
Index ¶
- Constants
- func AddPreferredProxy(proxy string, responseTime float64) error
- func ClearPreferredProxies() error
- func GetAllProxies() ([]string, error)
- func GetClient() *redis.Client
- func GetPreferredProxies() ([]string, error)
- func GetPreferredProxy() (string, error)
- func GetPreferredProxyCount() (int64, error)
- func GetProxyCount() (int64, error)
- func GetRandomProxy() (string, error)
- func InitRedis(addr string, password string, db int) error
- func RemovePreferredProxy(proxy string) error
- func RemoveProxy(proxy string) error
- func ReplaceProxies(proxies []string) error
Constants ¶
View Source
const ( ProxySetKey = "proxy:list" // 使用普通set存储代理 PreferredSetKey = "proxy:preferred" // 存储优选代理的有序集合 )
Variables ¶
This section is empty.
Functions ¶
func AddPreferredProxy ¶ added in v1.3.8
AddPreferredProxy 添加到优选代理列表,使用响应时间作为分数
func ClearPreferredProxies ¶ added in v1.3.8
func ClearPreferredProxies() error
ClearPreferredProxies 清空优选代理列表
func GetPreferredProxies ¶ added in v1.3.8
GetPreferredProxies 获取所有优选代理,按响应时间排序
func GetPreferredProxy ¶ added in v1.3.8
GetPreferredProxy 获取响应时间最快的优选代理
func GetPreferredProxyCount ¶ added in v1.3.8
GetPreferredProxyCount 获取优选代理数量
func RemovePreferredProxy ¶ added in v1.3.8
RemovePreferredProxy 从优选代理列表中删除
func ReplaceProxies ¶ added in v1.3.7
ReplaceProxies 替换所有代理
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.