Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-speedtest-cli

Golang command line interface for testing internet bandwidth using <https://speedtest.net, and then uploading the results to your https://speedtest.net account.

Uses

As an example, you can run the container image on a router at the push of a button or at a set interval, like every hour, to get the download and upload speeds and upload them to your https://www.speedtest.net account for later viewing.

Usage

There are two ways of using this:

  1. Supplying your username and password that you use to login to https://www.speedtest.net, via the --username and --password flags which in turn sets the request's Authorization header to use HTTP Basic Authentication with the provided username and password.
  2. Supplying the stnetsid cookie value after you have logged into https://www.speedtest.net, via the --cookies flag.

Build and Run

Build

git clone https://github.com/mbana/go-speedtest-cli.git
cd go-speedtest-cli
COOKIE_VALUE='a1aaaaaaaaaa11aaaaaaa1a1aa'
go run . --cookies "stnetsid=${COOKIE_VALUE}"

HTTP Basic Authentication

git clone https://github.com/mbana/go-speedtest-cli.git
cd go-speedtest-cli
USERNAME='your_username_from_speedtest.net'
PASSWORD='your_password_from_speedtest.net'
go run . --username "${USERNAME}" --password "${PASSWORD}"

Cookies

git clone https://github.com/mbana/go-speedtest-cli.git
cd go-speedtest-cli
COOKIE_VALUE='a1aaaaaaaaaa11aaaaaaa1a1aa'
go run . --cookies "stnetsid=${COOKIE_VALUE}"

Docker/Podman

Use one of podman/docker like below:

$ COOKIE_VALUE='a1aaaaaaaaaa11aaaaaaa1a1aa'
$ docker run --rm -it 'ghcr.io/mbana/go-speedtest-cli' --cookies "stnetsid=${COOKIE_VALUE}"
"https://ipinfo.io/json" -> {
    "ip": "178.255.93.241",
    "hostname": "e6-1qr.bana.io",
    "city": "London",
    "region": "England",
    "country": "GB",
    "loc": "51.5085,-0.1257",
    "org": "AS201838 Community Fibre Limited",
    "postal": "WC2N",
    "timezone": "Europe/London",
    "readme": "https://ipinfo.io/missingauth"
}
Waiting for speedtest to complete ...................
"./binaries/x86_64/speedtest" -> {
    "type": "result",
    "timestamp": "2026-07-09T09:18:35Z",
    "ping": {
        "jitter": 0.753,
        "latency": 1.778,
        "low": 1.474,
        "high": 2.496
    },
    "download": {
        "bandwidth": 306022616,
        "bytes": 2541707168,
        "elapsed": 8413,
        "latency": {
            "iqm": 1.390,
            "low": 0.809,
            "high": 210.107,
            "jitter": 5.373
        }
    },
    "upload": {
        "bandwidth": 486102062,
        "bytes": 4204306604,
        "elapsed": 8803,
        "latency": {
            "iqm": 22.574,
            "low": 1.348,
            "high": 33.079,
            "jitter": 5.291
        }
    },
    "packetLoss": 0,
    "isp": "Community Fibre Limited",
    "interface": {
        "internalIp": "172.17.0.2",
        "name": "eth0",
        "macAddr": "C6:D3:08:95:A1:A1",
        "isVpn": false,
        "externalIp": "178.255.93.241"
    },
    "server": {
        "id": 30690,
        "host": "speedtest.thn.lon.network.as201838.net",
        "port": 8080,
        "name": "Community Fibre Limited",
        "location": "London",
        "country": "United Kingdom",
        "ip": "93.113.26.250"
    },
    "result": {
        "id": "c111a8ec-9d0a-495f-be52-56299a43830d",
        "url": "https://www.speedtest.net/result/c/c111a8ec-9d0a-495f-be52-56299a43830d",
        "persisted": true
    }
}

"https://www.speedtest.net/api/results.php" -> {
    "app": {
        "sdk": {}
    },
    "serverid": 30690,
    "configs": {
        "preferredServer": {
            "version": {},
            "capabilities": {}
        },
        "latency": {},
        "loadedLatency": {},
        "jsEngine": {},
        "connections": {},
        "swf": {},
        "provider": {},
        "server": {}
    },
    "location": {
        "latitude": 51.5085,
        "longitude": -0.1257
    },
    "ispName": "Community Fibre Limited",
    "ping": 2,
    "jitter": 0.753,
    "latency": {},
    "upload": 4861020,
    "uploadSpeeds": {
        "local": {},
        "remote": {}
    },
    "download": 3060226,
    "downloadSpeeds": {
        "local": {}
    },
    "downloadLatency": {
        "tcp": {
            "rtt": {}
        }
    },
    "uploadLatency": {
        "tcp": {
            "rtt": {}
        }
    },
    "servers": {},
    "connections": {},
    "hash": "98f5240b759a7a2c0c23a23b8b682946",
    "clientip": "178.255.93.241",
    "serverSelection": {}
}
"https://www.speedtest.net/api/results.php" -> {
    "hash_key_id": "1d6d4ca57",
    "resultid": 19409928633,
    "date": "7/9/2026",
    "time": "9:18 AM",
    "rating": 0
}

About

Golang command line interface for testing internet bandwidth using https://speedtest.net.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages