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)
- func SpeedTestNew(proxies []proxy.Proxy)
- type ByDistance
- type Server
- type ServerList
- type Servers
- type Stat
- type StatList
- type User
- type Users
Constants ¶
This section is empty.
Variables ¶
var DelayConn = 500
var DelayTimeout = defaultURLTestTimeout
var RelayTimeout = defaultURLTestTimeout * 2
var SpeedConn = 5
var SpeedExist = false
var SpeedTimeout = time.Second * 10
Functions ¶
func HTTPGetBodyViaProxy ¶ added in v0.3.12
func HTTPGetBodyViaProxyWithTime ¶ added in v0.6.0
func HTTPGetBodyViaProxyWithTimeNoReturn ¶ added in v0.7.0
Get body without return to save memory
func ProxySpeedTest ¶ added in v0.3.12
ProxySpeedTest returns a speed result of a proxy. The speed result is like 20Mbit/s. -1 for error.
func RelayCheck ¶ added in v0.6.0
func SpeedTestAll ¶ added in v0.5.0
SpeedTestAll tests speed of a group of proxies. Results are stored in ProxyStats
func SpeedTestNew ¶ added in v0.5.0
SpeedTestNew tests speed of new proxies which is not in ProxyStats. Then appended to ProxyStats
Types ¶
type ByDistance ¶ added in v0.3.12
type ByDistance struct {
Servers
}
ByDistance : For sorting servers.
func (ByDistance) Less ¶ added in v0.3.12
func (b ByDistance) Less(i, j int) bool
Less : compare the distance. For sorting servers.
type Server ¶ added in v0.3.12
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 ¶ added in v0.3.12
type ServerList struct {
Servers []Server `xml:"servers>server"`
}
ServerList : List of Server. for xml decoding
type Servers ¶ added in v0.3.12
type Servers []Server
Servers : For sorting servers.
func (Servers) GetResult ¶ added in v0.3.12
GetResult : return testing result. -1 for no effective result
type Stat ¶ added in v0.5.0
type Stat struct { Speed float64 Delay uint16 ReqCount uint16 Relay bool Pool bool OutIp string Id string }
Statistic for a proxy
func (*Stat) UpdatePSDelay ¶ added in v0.5.0
Update delay for a Stat
func (*Stat) UpdatePSOutIp ¶ added in v0.6.0
Update out ip for a Stat
func (*Stat) UpdatePSSpeed ¶ added in v0.5.0
Update speed for a Stat
type StatList ¶ added in v0.5.0
type StatList []Stat
Statistic array for proxies
var ProxyStats StatList
ProxyStats stores proxies' statistics
func (StatList) ReqCountThan ¶ added in v0.5.0
Return proxies that request count more than a given nubmer