Documentation
¶
Index ¶
- Variables
- func AppendStat(s Stat)
- func CheckWorkpool(proxies proxy.ProxyList)
- func CleanBadProxiesWithWorkpool(proxies []proxy.Proxy) (cproxies []proxy.Proxy)
- func HTTPGetBodyForSpeedTest(clashProxy C.Proxy, url string, t time.Duration) error
- func HTTPGetBodyViaProxy(clashProxy C.Proxy, url string) ([]byte, error)
- func HTTPGetBodyViaProxyWithTime(clashProxy C.Proxy, url string, t time.Duration) ([]byte, error)
- func HTTPGetViaProxy(clashProxy C.Proxy, url string) error
- func HTTPHeadViaProxy(clashProxy C.Proxy, url string) error
- func IncReqCount(p proxy.Proxy)
- func InitSpeed(id string, speed float64)
- func ProxySpeedTest(p proxy.Proxy) (speedResult float64, err error)
- func RelayCheckWorkpool(proxies proxy.ProxyList)
- func SpeedTestAllWithWorkpool(proxies []proxy.Proxy, conns int)
- func SpeedTestNewWithWorkpool(proxies []proxy.Proxy, conns int)
- type ByDistance
- type Server
- type ServerList
- type Servers
- type Stat
- type StatList
- type User
- type Users
Constants ¶
This section is empty.
Variables ¶
var ( SpeedTimeout = time.Second * 10 SpeedExist = false )
var SupportCountry = []string{} /* 160 elements not displayed */
Functions ¶
func CheckWorkpool ¶ added in v0.9.2
func CleanBadProxiesWithWorkpool ¶ added in v0.7.1
CleanBadProxiesWithWorkpool 对代理做延迟检测,返回可用(延迟非 0)的代理列表。
func HTTPGetBodyForSpeedTest ¶
func IncReqCount ¶ added in v1.1.18
IncReqCount 并发安全地对代理的请求计数 +1,不存在则新建一条统计。
func InitSpeed ¶ added in v1.1.45
InitSpeed 恢复历史测速结果到统计(启动从数据库加载时调用)。 同时置 SpeedExist,使 provider 的速度过滤与标签立即生效。
func ProxySpeedTest ¶
ProxySpeedTest returns a speed result of a proxy. The speed result is like 20Mbit/s. -1 for error.
func RelayCheckWorkpool ¶ added in v0.7.1
RelayCheckWorkpool 检测代理是否经过中转/池化,结果写入 ProxyStats。
func SpeedTestAllWithWorkpool ¶ added in v0.7.1
SpeedTestAllWithWorkpool tests speed of a group of proxies. Results are stored in ProxyStats
func SpeedTestNewWithWorkpool ¶ added in v0.7.1
SpeedTestNewWithWorkpool tests speed of new proxies which is not in ProxyStats or whose speed is still 0. Then appended to ProxyStats.
Types ¶
type ByDistance ¶
type ByDistance struct {
Servers
}
ByDistance : For sorting servers.
func (ByDistance) Less ¶
func (b ByDistance) Less(i, j int) bool
Less : compare the distance. For sorting servers.
type Server ¶
type Server struct {
URL string `xml:"url,attr"`
Lat string `xml:"lat,attr"`
Lon string `xml:"lon,attr"`
Name string `xml:"name,attr"`
Country string `xml:"country,attr"`
Sponsor string `xml:"sponsor,attr"`
ID string `xml:"id,attr"`
URL2 string `xml:"url2,attr"`
Host string `xml:"host,attr"`
Distance float64
DLSpeed float64
}
Server information
type ServerList ¶
type ServerList struct {
Servers []Server `xml:"servers>server"`
}
ServerList : List of Server. for xml decoding
type Servers ¶
type Servers []Server
Servers : For sorting servers.
type Stat ¶
type Stat struct {
Speed float64
Delay uint16
ReqCount uint16
Relay bool
Pool bool
ChatGPT bool
OutIp string
Id string
}
Statistic for a proxy
type StatList ¶
type StatList []Stat
Statistic array for proxies
var ProxyStats StatList
ProxyStats stores proxies' statistics
func (StatList) ReqCountThan ¶
Return proxies that request count more than a given nubmer