2020-02-24 18:01:59 +00:00
|
|
|
![LibreSpeed Logo](https://github.com/librespeed/speedtest/blob/master/.logo/logo3.png?raw=true)
|
|
|
|
|
|
|
|
# LibreSpeed
|
|
|
|
|
|
|
|
No Flash, No Java, No WebSocket, No Bullshit.
|
|
|
|
|
|
|
|
This is a very lightweight speed test implemented in JavaScript, using XMLHttpRequest and Web Workers.
|
|
|
|
|
|
|
|
## Try it
|
|
|
|
[Take a speed test](https://speedtest.fdossena.com) (PHP implementation)
|
|
|
|
|
|
|
|
## Compatibility
|
2020-04-20 01:12:23 +00:00
|
|
|
All modern browsers are supported: IE11, latest Edge, latest Chrome, latest Firefox, latest Safari.
|
2020-02-24 18:01:59 +00:00
|
|
|
Works with mobile versions too.
|
|
|
|
|
|
|
|
## Features
|
|
|
|
* Download
|
|
|
|
* Upload
|
|
|
|
* Ping
|
|
|
|
* Jitter
|
|
|
|
* IP Address, ISP, distance from server (optional)
|
|
|
|
* Telemetry (optional)
|
|
|
|
* Results sharing (optional)
|
|
|
|
* Multiple Points of Test (optional)
|
2020-03-04 16:16:06 +00:00
|
|
|
* Compatible with PHP frontend predefined endpoints (with `.php` suffixes)
|
2020-02-24 18:01:59 +00:00
|
|
|
|
|
|
|
![Screenshot](https://speedtest.fdossena.com/mpot_v6.gif)
|
|
|
|
|
|
|
|
## Server requirements
|
|
|
|
* Any [Go supported platforms](https://github.com/golang/go/wiki/MinimumRequirements)
|
2020-02-26 09:00:15 +00:00
|
|
|
* BoltDB, PostgreSQL or MySQL database to store test results (optional)
|
2020-02-24 18:01:59 +00:00
|
|
|
* A fast! Internet connection
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2020-05-13 03:33:45 +00:00
|
|
|
You need Go 1.13+ to compile the binary. If you have an older version of Go and don't want to install the tarball
|
|
|
|
manually, you can install newer version of Go into your GOPATH:
|
|
|
|
|
|
|
|
0. Install Go 1.14
|
|
|
|
|
|
|
|
```
|
|
|
|
$ go get golang.org/dl/go1.14.2
|
|
|
|
# Assuming your GOPATH is default (~/go), Go 1.14.2 will be installed in ~/go/bin
|
|
|
|
$ ~/go/bin/go1.14.2 version
|
|
|
|
go version go1.14.2 linux/amd64
|
|
|
|
```
|
2020-02-24 18:01:59 +00:00
|
|
|
|
2020-04-03 01:23:22 +00:00
|
|
|
1. Clone this repository:
|
2020-02-24 18:01:59 +00:00
|
|
|
|
|
|
|
```
|
2020-04-03 01:23:22 +00:00
|
|
|
$ git clone github.com/librespeed/speedtest
|
|
|
|
# Switch to the Go branch
|
2020-05-13 03:33:45 +00:00
|
|
|
$ git checkout go
|
2020-02-24 18:01:59 +00:00
|
|
|
```
|
|
|
|
|
2020-04-03 01:23:22 +00:00
|
|
|
2. Build
|
|
|
|
```
|
|
|
|
# Change current working directory to the repository
|
|
|
|
$ cd speedtest
|
|
|
|
# Compile
|
|
|
|
$ go build -ldflags "-w -s" -trimpath -o speedtest main.go
|
|
|
|
```
|
2020-04-20 01:12:23 +00:00
|
|
|
|
2020-04-03 01:23:22 +00:00
|
|
|
3. Copy the `assets` directory, `settings.toml` file along with the compiled `speedtest` binary into a single directory
|
|
|
|
|
|
|
|
4. If you have telemetry enabled,
|
2020-02-26 09:00:15 +00:00
|
|
|
- For PostgreSQL/MySQL, create database and import the corresponding `.sql` file under `database/{postgresql,mysql}`
|
2020-02-24 18:01:59 +00:00
|
|
|
|
2020-02-26 09:00:15 +00:00
|
|
|
```
|
|
|
|
# assume you have already created a database named `speedtest` under current user
|
|
|
|
$ psql speedtest < database/postgresql/telemetry_postgresql.sql
|
|
|
|
```
|
2020-04-20 01:12:23 +00:00
|
|
|
|
2020-02-26 09:00:15 +00:00
|
|
|
- For embedded BoltDB, make sure to define the `database_file` path in `settings.toml`:
|
2020-04-20 01:12:23 +00:00
|
|
|
|
2020-02-26 09:00:15 +00:00
|
|
|
```
|
|
|
|
database_file="speedtest.db"
|
|
|
|
```
|
2020-02-24 18:01:59 +00:00
|
|
|
|
2020-04-03 01:23:22 +00:00
|
|
|
5. Put `assets` folder under the same directory as your compiled binary.
|
2020-02-24 18:01:59 +00:00
|
|
|
- Make sure the font files and JavaScripts are in the `assets` directory
|
|
|
|
- You can have multiple HTML pages under `assets` directory. They can be access directly under the server root
|
|
|
|
(e.g. `/example-singleServer-full.html`)
|
|
|
|
- It's possible to have a default page mapped to `/`, simply put a file named `index.html` under `assets`
|
|
|
|
|
2020-04-03 01:23:22 +00:00
|
|
|
6. Change `settings.toml` according to your environment:
|
2020-02-24 18:01:59 +00:00
|
|
|
|
|
|
|
```toml
|
2020-03-11 04:37:55 +00:00
|
|
|
# bind address, use empty string to bind to all interfaces
|
2020-02-24 18:01:59 +00:00
|
|
|
bind_address="127.0.0.1"
|
|
|
|
# backend listen port, default is 8989
|
|
|
|
listen_port=8989
|
2020-04-20 01:12:23 +00:00
|
|
|
# Server location
|
|
|
|
server_lat=0
|
|
|
|
server_lng=0
|
2020-02-24 18:01:59 +00:00
|
|
|
# ipinfo.io API key, if applicable
|
|
|
|
ipinfo_api_key=""
|
2020-04-20 01:12:23 +00:00
|
|
|
|
2020-02-24 18:01:59 +00:00
|
|
|
# password for logging into statistics page, change this to enable stats page
|
|
|
|
statistics_password="PASSWORD"
|
|
|
|
# redact IP addresses
|
|
|
|
redact_ip_addresses=false
|
2020-04-20 01:12:23 +00:00
|
|
|
|
2020-02-26 09:00:15 +00:00
|
|
|
# database type for statistics data, currently supports: bolt, mysql, postgresql
|
2020-02-24 18:01:59 +00:00
|
|
|
database_type="postgresql"
|
|
|
|
database_hostname="localhost"
|
|
|
|
database_name="speedtest"
|
|
|
|
database_username="postgres"
|
|
|
|
database_password=""
|
2020-04-20 01:12:23 +00:00
|
|
|
|
2020-02-26 09:00:15 +00:00
|
|
|
# if you use `bolt` as database, set database_file to database file location
|
|
|
|
database_file="speedtest.db"
|
2020-02-24 18:01:59 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Differences between Go and PHP implementation and caveats
|
|
|
|
|
2020-02-26 09:00:15 +00:00
|
|
|
- Since there is no CGo-free SQLite implementation available, I've opted to use [BoltDB](https://github.com/etcd-io/bbolt)
|
|
|
|
instead, as an embedded database alternative to SQLite
|
2020-02-24 18:01:59 +00:00
|
|
|
- Test IDs are generated ULID, there is no option to change them to plain ID
|
|
|
|
- You can use the same HTML template from the PHP implementation
|
2020-04-20 01:12:23 +00:00
|
|
|
- Server location can be defined in settings
|
2020-02-24 18:01:59 +00:00
|
|
|
- There might be a slight delay on program start if your Internet connection is slow. That's because the program will
|
|
|
|
attempt to fetch your current network's ISP info for distance calculation between your network and the speed test client's.
|
2020-02-26 09:00:15 +00:00
|
|
|
This action will only be taken once, and cached for later use.
|
2020-02-24 18:01:59 +00:00
|
|
|
|
|
|
|
## License
|
2020-04-20 01:12:23 +00:00
|
|
|
Copyright (C) 2016-2020 Federico Dossena
|
2020-02-24 18:01:59 +00:00
|
|
|
Copyright (C) 2020 Maddie Zhan
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2020-03-02 08:15:58 +00:00
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/lgpl>.
|