speedtest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByDistance

type ByDistance struct {
	Servers
}

ByDistance for sorting servers.

func (ByDistance) Less

func (b ByDistance) Less(i, j int) bool

Less compares 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
	Latency  time.Duration
	DLSpeed  float64
	ULSpeed  float64
}

Server information

func (Server) CheckResultValid

func (s Server) CheckResultValid() bool

CheckResultValid checks that results are logical given UL and DL speeds

func (*Server) DownloadTest

func (s *Server) DownloadTest(savingMode bool) error

DownloadTest executes the test to measure download speed

func (*Server) PingTest

func (s *Server) PingTest() error

PingTest executes test to measure latency

func (*Server) String

func (s *Server) String() string

String representation of Server

func (*Server) UploadTest

func (s *Server) UploadTest(savingMode bool) error

UploadTest executes the test to measure upload speed

type ServerList

type ServerList struct {
	Servers []*Server `xml:"servers>server"`
}

ServerList list of Server

func FetchServerList

func FetchServerList(user *User) (ServerList, error)

FetchServerList retrieves a list of available servers

func (*ServerList) FindServer

func (l *ServerList) FindServer(serverID []int) (Servers, error)

FindServer finds server by serverID

func (*ServerList) String

func (l *ServerList) String() string

String representation of ServerList

type Servers

type Servers []*Server

Servers for sorting servers.

func (Servers) Len

func (svrs Servers) Len() int

Len finds length of servers. For sorting servers.

func (Servers) Swap

func (svrs Servers) Swap(i, j int)

Swap swaps i-th and j-th. For sorting servers.

type User

type User struct {
	IP  string `xml:"ip,attr"`
	Lat string `xml:"lat,attr"`
	Lon string `xml:"lon,attr"`
	Isp string `xml:"isp,attr"`
}

User represents information determined about the caller by speedtest.net

func FetchUserInfo

func FetchUserInfo() (*User, error)

FetchUserInfo returns information about caller determined by speedtest.net

func (*User) String

func (u *User) String() string

String representation of User

type Users

type Users struct {
	Users []User `xml:"client"`
}

Users for decode xml

Jump to

Keyboard shortcuts

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