Documentation ¶
Index ¶
- type ByDistance
- type Server
- func (s Server) CheckResultValid() bool
- func (s *Server) DownloadTest(savingMode bool) error
- func (s *Server) DownloadTestContext(ctx context.Context, savingMode bool, dlWarmUp downloadWarmUpFunc, ...) error
- func (s *Server) PingTest() error
- func (s *Server) PingTestContext(ctx context.Context) error
- func (s *Server) String() string
- func (s *Server) UploadTest(savingMode bool) error
- func (s *Server) UploadTestContext(ctx context.Context, savingMode bool, ulWarmUp uploadWarmUpFunc, ...) error
- type ServerList
- type Servers
- type User
- type Users
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" json:"url"` Lat string `xml:"lat,attr" json:"lat"` Lon string `xml:"lon,attr" json:"lon"` Name string `xml:"name,attr" json:"name"` Country string `xml:"country,attr" json:"country"` Sponsor string `xml:"sponsor,attr" json:"sponsor"` ID string `xml:"id,attr" json:"id"` URL2 string `xml:"url2,attr" json:"url_2"` Host string `xml:"host,attr" json:"host"` Distance float64 `json:"distance"` Latency time.Duration `json:"latency"` DLSpeed float64 `json:"dl_speed"` ULSpeed float64 `json:"ul_speed"` }
Server information
func (Server) CheckResultValid ¶
CheckResultValid checks that results are logical given UL and DL speeds
func (*Server) DownloadTest ¶
DownloadTest executes the test to measure download speed
func (*Server) DownloadTestContext ¶
func (s *Server) DownloadTestContext( ctx context.Context, savingMode bool, dlWarmUp downloadWarmUpFunc, downloadRequest downloadFunc, ) error
DownloadTestContext executes the test to measure download speed, observing the given context.
func (*Server) PingTestContext ¶
PingTestContext executes test to measure latency, observing the given context.
func (*Server) UploadTest ¶
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 FetchServerListContext ¶
func FetchServerListContext(ctx context.Context, user *User) (ServerList, error)
FetchServerListContext retrieves a list of available servers, observing the given context.
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.
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 ¶
FetchUserInfo returns information about caller determined by speedtest.net
func FetchUserInfoContext ¶
FetchUserInfoContext returns information about caller determined by speedtest.net, observing the given context.