healthcheck

package
v0.0.0-...-fbe89ac Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DelayConn = 500
View Source
var DelayTimeout = defaultURLTestTimeout
View Source
var DownloadSize = 100
View Source
var RelayTimeout = defaultURLTestTimeout * 2
View Source
var SpeedConn = 5
View Source
var SpeedExist = false
View Source
var SpeedTimeout = time.Second * 10

Functions

func CleanBadProxies

func CleanBadProxies(proxies []proxy.Proxy) (cproxies []proxy.Proxy)

func CleanBadProxiesWithGrpool

func CleanBadProxiesWithGrpool(proxies []proxy.Proxy) (cproxies []proxy.Proxy)

func HTTPGetBodyViaProxy

func HTTPGetBodyViaProxy(clashProxy C.Proxy, url string) ([]byte, error)

func HTTPGetBodyViaProxyWithTime

func HTTPGetBodyViaProxyWithTime(clashProxy C.Proxy, url string, t time.Duration) ([]byte, error)

func HTTPGetBodyViaProxyWithTimeNoReturn

func HTTPGetBodyViaProxyWithTimeNoReturn(clashProxy C.Proxy, url string, t time.Duration) error

Get body without return to save memory

func HTTPGetViaProxy

func HTTPGetViaProxy(clashProxy C.Proxy, url string) error

func HTTPHeadViaProxy

func HTTPHeadViaProxy(clashProxy C.Proxy, url string) error

func PingFromChina

func PingFromChina(host string, port string) (bool, time.Duration, error)

func ProxySpeedTest

func ProxySpeedTest(p proxy.Proxy) (speedResult float64, err error)

func RelayCheck

func RelayCheck(proxies proxy.ProxyList)

func SpeedTestAll

func SpeedTestAll(proxies []proxy.Proxy)

SpeedTestAll tests speed of a group of proxies. Results are stored in ProxyStats

func SpeedTestNew

func SpeedTestNew(proxies []proxy.Proxy)

SpeedTestNew tests speed of new proxies which is not in ProxyStats. Then appended to ProxyStats

Types

type Stat

type Stat struct {
	Speed    float64
	Delay    time.Duration
	ReqCount uint16
	Relay    bool
	Pool     bool
	OutIp    string
	Id       string
}

Statistic for a proxy

func (*Stat) UpdatePSCount

func (ps *Stat) UpdatePSCount()

Count + 1 for a Stat

func (*Stat) UpdatePSDelay

func (ps *Stat) UpdatePSDelay(delay time.Duration)

Update delay for a Stat

func (*Stat) UpdatePSOutIp

func (ps *Stat) UpdatePSOutIp(outIp string)

Update out ip for a Stat

func (*Stat) UpdatePSSpeed

func (ps *Stat) UpdatePSSpeed(speed float64)

Update speed for a Stat

type StatList

type StatList []Stat

Statistic array for proxies

var ProxyStats StatList

ProxyStats stores proxies' statistics

func (StatList) Find

func (psList StatList) Find(p proxy.Proxy) (*Stat, bool)

Find a proxy's Stat in StatList

func (StatList) ReqCountThan

func (psList StatList) ReqCountThan(n uint16, pl []proxy.Proxy, reset bool) []proxy.Proxy

Return proxies that request count more than a given nubmer

func (StatList) SortProxiesBySpeed

func (psList StatList) SortProxiesBySpeed(proxies []proxy.Proxy) []proxy.Proxy

Sort proxies by speed. Notice that this returns the same pointer.

Jump to

Keyboard shortcuts

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