Documentation ¶
Index ¶
- Variables
- func CleanBadProxiesWithGrpool(proxies []proxy.Proxy) (cproxies []proxy.Proxy)
- func HTTPGetBodyViaProxy(clashProxy C.Proxy, url string) ([]byte, error)
- func HTTPGetBodyViaProxyWithTime(clashProxy C.Proxy, url string, t time.Duration) ([]byte, error)
- func HTTPGetBodyViaProxyWithTimeNoReturn(clashProxy C.Proxy, url string, t time.Duration) error
- func HTTPGetViaProxy(clashProxy C.Proxy, url string) error
- func HTTPHeadViaProxy(clashProxy C.Proxy, url string) error
- func ProxySpeedTest(p proxy.Proxy) (speedResult float64, err error)
- func RelayCheck(proxies proxy.ProxyList)
- func SpeedTestAll(proxies []proxy.Proxy, conns int)
- func SpeedTestNew(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 ¶
View Source
var DelayTimeout = defaultURLTestTimeout
View Source
var RelayTimeout = defaultURLTestTimeout * 2
View Source
var SpeedExist = false
View Source
var SpeedTimeout = time.Second * 10
Functions ¶
func HTTPGetBodyViaProxyWithTimeNoReturn ¶
Get body without return to save memory
func ProxySpeedTest ¶
ProxySpeedTest returns a speed result of a proxy. The speed result is like 20Mbit/s. -1 for error.
func RelayCheck ¶
func SpeedTestAll ¶
SpeedTestAll tests speed of a group of proxies. Results are stored in ProxyStats
func SpeedTestNew ¶
SpeedTestNew tests speed of new proxies which is not in ProxyStats. 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 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
Click to show internal directories.
Click to hide internal directories.