jnovack / speedtest-cli

Speedtest CLI for golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

speedtest.net CLI

This is a simple command line client to speedtest.net written in Go.

It is a direct port from https://github.com/sivel/speedtest-cli written in Python. It lacks some of the features though, e.g. -mini and -share options are not supported.

Installation

Run te following commands in console

go get github.com/surol/speedtest-cli
go install github.com/surol/speedtest-cli

Usage

Without any arguments speedtest-cli tests the speed against the closest server with the lowest latency.

The following command line options are available:

Command line interface for testing internet bandwidth using speedtest.net.

  -bytes
    	Display values in bytes instead of bits. Does not affect the image generated by -share
  -download
    	Run a download test only (also runs latency test)
  -help
    	Show usage information and exit
  -host string
    	Server where metrics are collected
  -id string
    	The id for this host (e.g. hostname) (defaults to your hostname)
  -interface string
    	IP address of network interface to bind to
  -latency
    	Run a latency test only
  -list
    	Display a list of speedtest.net servers sorted by distance
  -port string
    	Port where server is listening on
  -quiet
    	Suppress all output (overrides --verbose)
  -secure
    	Use HTTPS instead of HTTP when communicating with speedtest.net operated servers (default true)
  -server uint
    	Specify a server ID to test against
  -timeout duration
    	HTTP timeout duration. Default 10s (default 10s)
  -upload
    	Run an upload test only (also runs latency test)
  -verbose
    	Show all debugging and extraneous information
  -version
    	Show the version number and exit

JSON Post Data

Latency

{ "metric": { "name": "latency", "value": 11, "units": "ms" }, "client": { "hostname": "testing.local", "ip": "203.0.113.10", "isp": "Google Fiber", "latitude": 39.8283, "longitude": -98.5795, "country": "US" }, "server": { "id": 17414, "sponsor": "goBEC Fiber Network", "city": "Cassville, MO", "country": "United States", "distance": 75.31, "url": "http://speedtest.gobec.net/speedtest/upload.php", "host": "speedtest.gobec.net:8080", "latency": 11 }}

Download Speed

{ "metric": { "name": "download", "value": 95.5741, "units": "Mb" }, "client": "{ "hostname": "testing.local", "ip": "203.0.113.10", "isp": "Google Fiber", "latitude": 39.8283, "longitude": -98.5795, "country": "US" }", "server": { "id": 17414, "sponsor": "goBEC Fiber Network", "city": "Cassville, MO", "country": "United States", "distance": 75.31, "url": "http://speedtest.gobec.net/speedtest/upload.php", "host": "speedtest.gobec.net:8080", "latency": 11 }}

Upload Speed

{ "metric": { "name": "upload", "value": 84.3390, "units": "Mb" }, "client": "{ "hostname": "testing.local", "ip": "203.0.113.10", "isp": "Google Fiber", "latitude": 39.8283, "longitude": -98.5795, "country": "US" }", "server": { "id": 17414, "sponsor": "goBEC Fiber Network", "city": "Cassville, MO", "country": "United States", "distance": 75.31, "url": "http://speedtest.gobec.net/speedtest/upload.php", "host": "speedtest.gobec.net:8080", "latency": 11 }}

About

Speedtest CLI for golang


Languages

Language:Go 81.5%Language:Makefile 18.5%