speedtest

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientInfo

func GetClientInfo() (*clientSpeedtestConfig, error)

通过httpget访问clientConfigUrl得到客户端信息

func GetServerLists

func GetServerLists() (*serverSettings, error)

通过httpget访问serversConfigUrl得到服务器列表信息

func HumanSpeed

func HumanSpeed(bps uint64) string

func Run

func Run()

Types

type Config

type Config struct {
	LicenseKey string
	IP         net.IP
	Lat        float64
	Long       float64
	ISP        string
	Servers    []Testserver
}

type Testserver

type Testserver struct {
	Name     string
	Sponsor  string
	Country  string
	Lat      float64
	Long     float64
	Distance float64 //距离服务器的距离单位KM
	URLs     []string
	Host     string
	Latency  time.Duration //latency in ms
}

func (*Testserver) Downstream

func (ts *Testserver) Downstream(duration int) (uint64, error)

Downstream measures upstream bandwidth in bps

func (*Testserver) MedianPing

func (ts *Testserver) MedianPing(count int) (time.Duration, error)

MedianPing runs a latency test against the server and stores the median latency

func (*Testserver) Ping

func (ts *Testserver) Ping(count int) ([]time.Duration, error)

Ping will run count number of latency tests and return the results of each

func (*Testserver) Upstream

func (ts *Testserver) Upstream(duration int) (uint64, error)

Upstream measures upstream bandwidth in bps

Jump to

Keyboard shortcuts

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