This is a lightweight backend written in Rust for Librespeed.
Find a file
2021-10-04 00:59:30 +10:00
assets Initial commit 2021-10-03 19:23:35 +10:00
src Logic/code cleanup 2021-10-04 00:57:12 +10:00
.env.example Add distance calculation 2021-10-03 21:52:23 +10:00
.gitignore Initial commit 2021-10-03 19:23:35 +10:00
Cargo.lock Logic/code cleanup 2021-10-04 00:57:12 +10:00
Cargo.toml Add license to cargo.toml 2021-10-04 00:59:30 +10:00
LICENSE Initial commit 2021-10-03 19:23:35 +10:00
README.md Add distance calculation 2021-10-03 21:52:23 +10:00

speedtest-rs

This is a lightweight backend written in Rust for Librespeed.

Compatibility

Supported by all Librespeed frontends, though some features are missing (see below).

Features

  • Download
  • Upload
  • Ping
  • Jitter
  • IP Address, ISP
  • Multiple Points of Test (optional)
  • Compatible with PHP frontend predefined endpoints (with .php suffixes)
  • Distance from server (optional)
  • Telemetry (optional)
  • Results sharing (optional)
  • Proxy Protocol?

Server requirements

  • A Rust supported platform
  • A fast! Internet connection

Installation

You need Rust 1.55+ to compile the binary.

  1. Clone this repository:
git clone github.com/drobson03/speedtest-rs
# Change current working directory to the repository
cd speedtest-rs
  1. Build before running
# Compile to target/release/speedtest-rs
cargo build --release
  1. Copy the assets directory and the compiled speedtest-rs binary into a single directory along with a copy of .env.example named .env with your preferred port, listen address and IPinfo.io API token.

  2. Put assets folder under the same directory as your compiled binary.

    • Make sure font files and JavaScript files 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
  3. Change .env according to your environment:

# your ipinfo.io API token
IPINFO_TOKEN=
# your server's latitude
SERVER_LATITUDE=1
# your server's longitude
SERVER_LONGITUDE=1
# the port to bind to
ROCKET_PORT=8000
# the bind address (0.0.0.0 is all interfaces)
ROCKET_ADDRESS=0.0.0.0

Differences between Go and PHP implementation

  • FAST (no garbage collector unlike Go)

License

Copyright (C) 2016-2021 Federico Dossena

Copyright (C) 2021 Darcy Robson

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 along with this program. If not, see https://www.gnu.org/licenses/lgpl.