speedtestnet

package
v0.0.0-...-ccadce5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CFG_DOWNLOAD_SIZES = "downloadSizes"
View Source
const CFG_MAX_SECONDS = "maxSeconds"
View Source
const CFG_SERVER_HOST = "Host"
View Source
const CFG_SERVER_ID = "serverID"
View Source
const CFG_TEST_TYPE = "testType"
View Source
const CFG_TIME_OUT = "timeOut"
View Source
const CFG_TYPE_ALL = "allTests"
View Source
const CFG_TYPE_DOWNLOAD = "downloadTest"
View Source
const CFG_TYPE_LATENCY = "latencyTest"
View Source
const CFG_TYPE_SPEED_TEST = "speedTest"
View Source
const CFG_TYPE_UPLOAD = "uploadTest"
View Source
const CFG_UPLOAD_SIZES = "uploadSizes"
View Source
const MillisecondInt64 = int64(time.Millisecond)

Variables

Functions

func DownloadTest

func DownloadTest(server *server, length float64, sizes []int)

DownloadTest - controls Downloader goroutine @param server - a pointer to a server @param length - the maximum number of seconds this upload is allowed to take @param sizes - if this is left empty, then ten default sizes will be

used each bigger than the previous one

func GetServerByID

func GetServerByID(id string) server

func LatencyTest

func LatencyTest(server *server)

Tests the latency of the server in question and registers the value in server.Speedtest.Results.Latency

func NewClient

func NewClient() (*agent.Task, error)

func UploadTest

func UploadTest(server *server, length float64, sizes []int)

Function that controls Uploader goroutine @param server - a pointer to a speedtest.Server @param length - the maximum number of seconds this upload is allowed to take @param sizes - if this is left empty, then seven default sizes will be

used each bigger than the previous one

Types

type SpeedTestRunner

type SpeedTestRunner struct{}

func (SpeedTestRunner) Run

Run ensures all the needed agent.TaskData values are present and valid and

runs a Latency Test as well as any other requested test(s)

Here are the required values ...
  taskData.IntValues:
    - CFG_SERVER_ID
    - CFG_TIME_OUT
  taskData.StringValues:
    - CFG_SERVER_HOST
    - CFG_TEST_TYPE ...  CFG_TYPE_ALL | CFG_TYPE_DOWNLOAD | CFG_TYPE_LATENCY | CFG_TYPE_UPLOAD
  taskData.FloatValues:
    - CFG_MAX_SECONDS ... (not required for Latency Tests)
  taskData.IntSlices:
    - CFG_DOWNLOAD_SIZES ... (only required for Download Tests)
    - CFG_UPLOAD_SIZES ... (only required for Upload Tests)

Jump to

Keyboard shortcuts

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