Documentation
¶
Index ¶
- type ByDistance
- type ByLatency
- type Client
- func (stClient *Client) DownloadSpeed(url string) (speed float64, err error)
- func (stClient *Client) GetClosestServers(servers []Server) []Server
- func (stClient *Client) GetConfig() (c Config, err error)
- func (stClient *Client) GetFastestServer(servers []Server) Server
- func (stClient *Client) GetLatency(server Server, url string) (result float64, err error)
- func (stClient *Client) GetLatencyURL(server Server) string
- func (stClient *Client) GetServers() (servers []Server, err error)
- func (stClient *Client) UploadSpeed(url string, mimetype string, data []byte) (speed float64, err error)
- type Config
- type HTTPConfig
- type Server
- type SpeedtestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByDistance ¶
type ByDistance []Server
ByDistance allows us to sort servers by distance
func (ByDistance) Len ¶
func (server ByDistance) Len() int
func (ByDistance) Less ¶
func (server ByDistance) Less(i, j int) bool
func (ByDistance) Swap ¶
func (server ByDistance) Swap(i, j int)
type Client ¶
type Client struct { Config *Config SpeedtestConfig *SpeedtestConfig HTTPConfig *HTTPConfig Debug bool ReportChar string }
Client define a Speedtest HTTP client
func NewClient ¶
func NewClient(speedtestConfig *SpeedtestConfig, httpConfig *HTTPConfig, debug bool, reportChar string) *Client
NewClient define a new Speedtest client.
func (*Client) DownloadSpeed ¶
DownloadSpeed measures the mbps of downloading a URL
func (*Client) GetClosestServers ¶
GetClosestServers takes the full server list and sorts by distance
func (*Client) GetFastestServer ¶
GetFastestServer test all servers until we find numServers that respond, then find the fastest of them. Some servers show up in the master list but timeout or are "corrupt" therefore we bump their latency to something really high (1 minute) and they will drop out of this test
func (*Client) GetLatency ¶
GetLatency will test the latency (ping) the given server NUMLATENCYTESTS times and return either the lowest or average depending on what algorithm is set
func (*Client) GetLatencyURL ¶
GetLatencyURL will return the proper url for the latency
func (*Client) GetServers ¶
GetServers will get the full server list
type HTTPConfig ¶
HTTPConfig define settings for HTTP requests