speedtest

package
v0.0.0-...-4ae0e5e Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockSpeedtest

type MockSpeedtest struct {
	Callback func()
	Fail     bool
	Result   *SpeedtestResult
}

func (*MockSpeedtest) Speedtest

func (s *MockSpeedtest) Speedtest() *SpeedtestResult

type Speedtest

type Speedtest interface {
	Speedtest() *SpeedtestResult
}

type SpeedtestCLI

type SpeedtestCLI struct {
	// contains filtered or unexported fields
}

func NewSpeedtestCLI

func NewSpeedtestCLI(executable string) (*SpeedtestCLI, error)

Create SpeedtestCLI, fails when it can't find the speedtest-cli binary Arguments:

executable: name or full path to speedtest-cli binary

func (*SpeedtestCLI) Path

func (s *SpeedtestCLI) Path() string

Get path of the speedtest-cli binary

func (*SpeedtestCLI) Speedtest

func (s *SpeedtestCLI) Speedtest() *SpeedtestResult

Execute the speedtest-cli binary and parse the result

type SpeedtestGo

type SpeedtestGo struct {
}

func NewSpeedtest

func NewSpeedtest() *SpeedtestGo

Create instance of Speedtest

func (*SpeedtestGo) Speedtest

func (s *SpeedtestGo) Speedtest() *SpeedtestResult

Use the speedtest-go api to run a speedtest and parse the result

type SpeedtestResult

type SpeedtestResult struct {
	// contains filtered or unexported fields
}

func NewFailedSpeedtestResult

func NewFailedSpeedtestResult() *SpeedtestResult

Create a new SpeedtestResult for a failed speedtest.

func NewSpeedtestResult

func NewSpeedtestResult(jitterLatency float64, ping float64, downloadSpeed float64, uploadSpeed float64, dataUsed float64, clientIsp string, clientIp string) *SpeedtestResult

Create a new SpeedtestResult from a successfull speedrun

func (*SpeedtestResult) ClientIp

func (r *SpeedtestResult) ClientIp() string

Public IP of the client/connection

func (*SpeedtestResult) ClientIsp

func (r *SpeedtestResult) ClientIsp() string

ISP name of the client/connection

func (*SpeedtestResult) DataUsed

func (r *SpeedtestResult) DataUsed() float64

Data usage of speedtest in MB

func (*SpeedtestResult) DownloadSpeed

func (r *SpeedtestResult) DownloadSpeed() float64

Download speed im Mbps

func (*SpeedtestResult) JitterLatency

func (r *SpeedtestResult) JitterLatency() float64

Jitter latency of ping in ms

func (*SpeedtestResult) Ping

func (r *SpeedtestResult) Ping() float64

Ping in ms

func (*SpeedtestResult) Success

func (r *SpeedtestResult) Success() bool

Indicates if the test was successfull

func (*SpeedtestResult) UploadSpeed

func (r *SpeedtestResult) UploadSpeed() float64

Upload speed in Mbps

Jump to

Keyboard shortcuts

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