speedtest

package
v0.0.0-...-04b60ce Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateErrorSummary

func CreateErrorSummary(err error, s Server) map[string]interface{}

func CreateErrorSummaryWithoutServerInfo

func CreateErrorSummaryWithoutServerInfo(err error) map[string]interface{}

Types

type Interface

type Interface struct {
	InternalIP string `json:"internalIp"`
	Name       string `json:"name"`
	MacAddr    string `json:"macAddr"`
	IsVpn      bool   `json:"isVpn"`
	ExternalIP string `json:"externalIp"`
}

type Ping

type Ping struct {
	Jitter  float64 `json:"jitter"`
	Latency float64 `json:"latency"`
}

type Result

type Result struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

type Server

type Server struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Location string `json:"location"`
	Country  string `json:"country"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	IP       string `json:"ip"`
}

type ServerList

type ServerList struct {
	Type      string    `json:"type"`
	Timestamp time.Time `json:"timestamp"`
	Servers   []Server  `json:"servers"`
}

func ListServers

func ListServers() (*ServerList, error)

type SpeedResult

type SpeedResult struct {
	Bandwidth int `json:"bandwidth"`
	Bytes     int `json:"bytes"`
	Elapsed   int `json:"elapsed"`
}

func (*SpeedResult) BandwidthInMbps

func (s *SpeedResult) BandwidthInMbps() float64

type SpeedtestResult

type SpeedtestResult struct {
	Type       string      `json:"type"`
	Timestamp  time.Time   `json:"timestamp"`
	Ping       Ping        `json:"ping"`
	Download   SpeedResult `json:"download"`
	Upload     SpeedResult `json:"upload"`
	PacketLoss float64     `json:"packetLoss"`
	Isp        string      `json:"isp"`
	Interface  Interface   `json:"interface"`
	Server     Server      `json:"server"`
	Result     Result      `json:"result"`
}

func Test

func Test() (*SpeedtestResult, error)

func TestForServer

func TestForServer(s Server) (*SpeedtestResult, error)

func (*SpeedtestResult) CreateSummary

func (s *SpeedtestResult) CreateSummary() map[string]interface{}

func (*SpeedtestResult) DownloadInMbps

func (s *SpeedtestResult) DownloadInMbps() float64

func (*SpeedtestResult) ToString

func (r *SpeedtestResult) ToString() string

func (*SpeedtestResult) UploadInMbps

func (s *SpeedtestResult) UploadInMbps() float64

Jump to

Keyboard shortcuts

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