Skip to content

Instantly share code, notes, and snippets.

@ChaosJohn
Forked from itsChris/Speedtest CLI by Ookla.md
Created December 7, 2023 02:48
Show Gist options
  • Select an option

  • Save ChaosJohn/e4e98152d867ef8b79b0f7c128d0ab91 to your computer and use it in GitHub Desktop.

Select an option

Save ChaosJohn/e4e98152d867ef8b79b0f7c128d0ab91 to your computer and use it in GitHub Desktop.

Revisions

  1. @itsChris itsChris revised this gist Jan 4, 2021. No changes.
  2. @itsChris itsChris created this gist Jan 4, 2021.
    280 changes: 280 additions & 0 deletions Speedtest CLI by Ookla.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,280 @@
    <!DOCTYPE html>
    <html>

    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Speedtest CLI by Ookla</title>
    <link rel="stylesheet" href="https://stackedit.io/style.css" />
    </head>

    <body class="stackedit">
    <div class="stackedit__html"><h1 id="speedtest">Speedtest</h1>
    <h2 id="name">Name</h2>
    <p><strong>speedtest</strong> - Speedtest CLI by Ookla is the official command line client for testing the speed and performance of your internet connection.</p>
    <h2 id="version">Version</h2>
    <p>1.0.0</p>
    <h2 id="synopsis">Synopsis</h2>
    <pre><code> speedtest [-aAbBfhiIpPsv] [--ca-certificate=path] [--format=[=format-type]] [--help] [--interface=interface]
    [--ip=ip_address] [--output-header] [--precision=num_decimal_places] [--progress=yes|no]
    [--selection-details] [--server-id=id] [--servers] [--unit=[=unit-of-measure]] [--version]
    </code></pre>
    <h2 id="description">Description</h2>
    <p><strong>speedtest</strong> is an application that measures the latency, jitter, packet loss, download bandwidth, and<br>
    upload bandwidth of the network connection between the client and a nearby Speedtest<br>
    Server.</p>
    <h2 id="options">Options</h2>
    <ul>
    <li>
    <p><strong>-h, --help</strong><br>
    Print usage information</p>
    </li>
    <li>
    <p><strong>-v</strong><br>
    Logging verbosity, specify multiple times for higher verbosity (e.g. <strong>-vvv</strong>)</p>
    </li>
    <li>
    <p><strong>-V, --version</strong><br>
    Print version number</p>
    </li>
    <li>
    <p><strong>-L, --servers</strong><br>
    List nearest servers</p>
    </li>
    <li>
    <p><strong>–selection-details</strong><br>
    Show server selection details</p>
    </li>
    <li>
    <p><strong>-s</strong> <em>id</em>, <strong>–server-id</strong>=<em>id</em><br>
    Specify a server from the server list using its id</p>
    </li>
    <li>
    <p><strong>-o</strong> <em>hostname</em>, <strong>–host</strong>=<em>hostname</em><br>
    Specify a server from the server list using its hostname</p>
    </li>
    <li>
    <p><strong>-f</strong> <em>format_type</em> <strong>–format</strong>=<em>format_type</em><br>
    Output format (default = human-readable)<br>
    Note: Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes<br>
    as the unit of measure with max precision.</p>
    <p><em>format_type</em> values are as follows:</p>
    <ul>
    <li><strong>human-readable</strong> human readable output</li>
    <li><strong>csv</strong> comma separated values</li>
    <li><strong>tsv</strong> tab separated values</li>
    <li><strong>json</strong> javascript object notation (compact)</li>
    <li><strong>jsonl</strong> javascript object notation (lines)</li>
    <li><strong>json-pretty</strong> javascript object notation (pretty)</li>
    </ul>
    </li>
    <li>
    <p><strong>–output-header</strong><br>
    Show output header for CSV and TSV formats</p>
    </li>
    <li>
    <p><strong>-u</strong>* unit_of_measure***,&nbsp;--unit*** unit_of_measure*<br>
    Output unit for displaying speeds (Note: this is only applicable<br>
    for ‘human-readable’ output format and the default unit is Mbps)</p>
    <ul>
    <li><strong>bps</strong> bits per second (decimal prefix)</li>
    <li><strong>kbps</strong> kilobits per second (decimal prefix)</li>
    <li><strong>Mbps</strong> megabits per second (decimal prefix)</li>
    <li><strong>Gbps</strong> gigabits per second (decimal prefix)</li>
    <li><strong>kibps</strong> kilobits per second (binary prefix)</li>
    <li><strong>Mibps</strong> megabits per second (binary prefix)</li>
    <li><strong>Gibps</strong> gigabits per second (binary prefix)</li>
    <li><strong>B/s</strong> bytes per second</li>
    <li><strong>kB/s</strong> kilobytes per second</li>
    <li><strong>MB/s</strong> megabytes per second</li>
    <li><strong>GiB/s</strong> gigabytes per second</li>
    <li><strong>auto-binary-bytes</strong> automatic in binary bytes</li>
    <li><strong>auto-decimal-bytes</strong> automatic in decimal bytes</li>
    <li><strong>auto-binary-bytes</strong> automatic in binary bits</li>
    <li><strong>auto-binary-bytes</strong> automatic in decimal bits</li>
    </ul>
    </li>
    <li>
    <p><strong>-a</strong><br>
    Shortcut for [<strong>-u auto-decimal-bits</strong>]</p>
    </li>
    <li>
    <p><strong>-A</strong><br>
    Shortcut for [<strong>-u auto-decimal-bytes</strong>]</p>
    </li>
    <li>
    <p><strong>-b</strong><br>
    Shortcut for [<strong>-u auto-binary-bits</strong>]</p>
    </li>
    <li>
    <p><strong>-B</strong><br>
    Shortcut for [<strong>-u auto-binary-bytes</strong>]</p>
    </li>
    <li>
    <p><strong>-P</strong> <em>decimal_places</em> <strong>–precision</strong>=<em>decimal_places</em><br>
    Number of decimal_places to use (default = 2, valid = 0-8)</p>
    </li>
    <li>
    <p><strong>-p</strong> <em>yes</em>|<em>no</em> <strong>–progress</strong>=<em>yes</em>|<em>no</em><br>
    Enable or disable progress bar (default = yes when interactive)</p>
    </li>
    <li>
    <p><strong>-I</strong> <em>interface</em> <strong>–interface</strong>=<em>interface</em><br>
    Attempt to bind to the specified interface when connecting to servers</p>
    </li>
    <li>
    <p><strong>-i</strong> <em>ip_address</em> <strong>–ip</strong>=<em>ip_address</em><br>
    Attempt to bind to the specified IP address when connecting to servers</p>
    </li>
    <li>
    <p><strong>–ca-certificate</strong>=<em>path</em><br>
    Path to CA Certificate bundle, see note below.</p>
    </li>
    </ul>
    <h2 id="terms-of-use-and-privacy-policy-notices">Terms of Use and Privacy Policy Notices</h2>
    <p>You may only use this Speedtest software and information generated from it for personal, non-commercial use,<br>
    through a command line interface on a personal computer. Your use of this software is subject to the End User<br>
    License Agreement, Terms of Use and Privacy Policy at these URLs:</p>
    <ul>
    <li><a href="https://www.speedtest.net/about/eula">https://www.speedtest.net/about/eula</a></li>
    <li><a href="https://www.speedtest.net/about/terms">https://www.speedtest.net/about/terms</a></li>
    <li><a href="https://www.speedtest.net/about/privacy">https://www.speedtest.net/about/privacy</a></li>
    </ul>
    <h2 id="output">Output</h2>
    <p>Upon successful execution, the application will exit with an exit code of 0. The result will include<br>
    latency, jitter, download, upload, packet loss (where available), and a result URL.</p>
    <p>Latency and jitter will be represented in milliseconds. Download and upload units will depend on the output<br>
    format as well as if a unit was specified. The human-readable format defaults to Mbps and any machine-readable<br>
    formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision. Packet loss is represented as a percentage, or <strong>Not available</strong> when packet loss is unavailable in the executing network environment.</p>
    <p>The Result URL is available to share your result, appending <strong>.png</strong> to the Result URL will create a<br>
    shareable result image.</p>
    <p><em>Example human-readable result:</em></p>
    <pre><code>$ speedtest
    Speedtest by Ookla

    Server: Speedtest.net - New York, NY (id = 10390)
    ISP: Comcast Cable
    Latency: 57.81 ms (3.65 ms jitter)
    Download: 76.82 Mbps (data used: 80.9 MB)
    Upload: 37.58 Mbps (data used: 65.3 MB)
    Packet Loss: 0.0%
    Result URL: https://www.speedtest.net/result/c/8ae1200c-e639-45e5-8b55-41421a079250
    </code></pre>
    <h2 id="network-timeout-values">Network Timeout Values</h2>
    <p>By default, network requests set a timeout of <strong>10</strong> seconds. The only exception to this<br>
    is latency testing, which sets a timeout of <strong>15</strong> seconds.</p>
    <h2 id="fatal-errors">Fatal Errors</h2>
    <p>Upon fatal errors, the application will exit with a non-zero exit code.</p>
    <p><strong>Initialization Fatal Error Examples:</strong></p>
    <p><em>Configuration - Couldn’t connect to server (Network is unreachable)</em></p>
    <p><em>Configuration - Could not retrieve or read configuration (ConfigurationError)</em></p>
    <p><strong>Stage Execution Fatal Error Example:</strong></p>
    <p><em>[error] Error: [1] Latency test failed for HTTP</em></p>
    <p><em>[error] Error: [36] Cannot open socket: Operation now in progress</em></p>
    <p><em>[error] Failed to resolve host name. Cancelling test suite.</em></p>
    <p><em>[error] Host resolve failed: Exec format error</em></p>
    <p><em>[error] Cannot open socket: No route to host</em></p>
    <p><em>[error] Server Selection - Failed to find a working test server. (NoServers)</em></p>
    <h2 id="ssl-certificate-locations">SSL Certificate Locations</h2>
    <p>By default the following paths are checked for CA certificate bundles on linux machines:</p>
    <pre><code>/etc/ssl/certs/ca-certificates.crt
    /etc/pki/tls/certs/ca-bundle.crt
    /usr/share/ssl/certs/ca-bundle.crt
    /usr/local/share/certs/ca-root-nss.crt
    /etc/ssl/cert.pem
    </code></pre>
    <p>If the device under test does <em>not</em> have one of the above mentioned files, then the canonical and up to date CA certificate bundle provided by the curl project can be manually<br>
    downloaded into a specific location. This specific location can be provided as a parameter per the following example:</p>
    <pre><code>wget https://curl.haxx.se/ca/cacert.pem
    ./ookla --ca-certificate=./cacert.pem
    </code></pre>
    <h2 id="release-notes">Release Notes</h2>
    <h3 id="section">1.0.0 - 10/29/2019</h3>
    <ul>
    <li>Initial release</li>
    </ul>
    <h2 id="copyright-notices-for-third-party-productslibraries">Copyright Notices for Third-Party Products/Libraries</h2>
    <p>This software incorporates free and open source third-party libraries, including:</p>
    <ul>
    <li><a href="https://www.boost.org/">boost</a></li>
    <li><a href="https://curl.haxx.se/libcurl/">libcurl</a></li>
    <li><a href="https://www.lysator.liu.se/~pen/petopt/">petopt</a></li>
    <li><a href="https://tls.mbed.org/">mbed TLS</a></li>
    <li><a href="https://curl.haxx.se/docs/caextract.html">ca-certificates extract</a></li>
    <li><a href="https://sourceforge.net/projects/libmd5-rfc/files/">L. Peter Deutsch’s md5</a></li>
    <li>[getopt.h](in Windows version of this software)</li>
    <li><a href="https://github.com/kokke/tiny-AES-c">tiny-aes</a></li>
    <li><a href="https://github.com/okdshin/PicoSHA2">PicoSHA2</a></li>
    <li><a href="https://www.musl-libc.org/">musl</a></li>
    </ul>
    <p>Inclusion of mbed TLS is subject to presentation of the following license terms<br>
    to recipients of this software: <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br>
    (a copy of which is included with the documentation of this software)</p>
    <h3 id="inclusion-of-libcurl-is-subject-to-distribution-of-the-software-with-the-following-notice">Inclusion of libcurl is subject to distribution of the software with the following notice:</h3>
    <pre><code>Copyright (c) 1996 - 2019, Daniel Stenberg, [email protected], and many contributors,
    see the THANKS file. All rights reserved. Permission to use, copy, modify, and distribute
    this software for any purpose with or without fee is hereby granted, provided that
    the above copyright notice and this permission notice appear in all copies.
    </code></pre>
    <h3 id="inclusion-of-getopt.h-is-subject-to-distribution-of-the-software-with-the-following-notice">Inclusion of getopt.h is subject to distribution of the software with the following notice:</h3>
    <pre><code>DISCLAIMER
    This file is part of the mingw-w64 runtime package.

    The mingw-w64 runtime package and its code is distributed in the hope that it
    will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
    IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
    warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


    Copyright (c) 2002 Todd C. Miller &lt;[email protected]&gt;

    Permission to use, copy, modify, and distribute this software for any
    purpose with or without fee is hereby granted, provided that the above
    copyright notice and this permission notice appear in all copies.

    Copyright (c) 2000 The NetBSD Foundation, Inc.
    All rights reserved.

    This code is derived from software contributed to The NetBSD Foundation
    by Dieter Baron and Thomas Klausner.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:
    1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.
    </code></pre>
    <h3 id="inclusion-of-picosha2-is-subject-to-distribution-of-the-software-with-the-following-notice">Inclusion of PicoSHA2 is subject to distribution of the software with the following notice:</h3>
    <pre><code>Copyright (c) 2017 okdshin

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    </code></pre>
    <h3 id="inclusion-of-musl-is-subject-to-distribution-of-the-software-with-the-following-notice">Inclusion of musl is subject to distribution of the software with the following notice:</h3>
    <pre><code>Copyright © 2005-2019 Rich Felker, et al.

    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    "Software"), to deal in the Software without restriction, including
    without limitation the rights to use, copy, modify, merge, publish,
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.
    </code></pre>
    </div>
    </body>

    </html>