Add public server links to README, fix dead_code warnings
All checks were successful
CI / test (push) Successful in 2m12s

- Add Free Public Servers section with US/EU endpoints and usage examples
- Add Server Pro section documenting the optional pro build
- Add Android/Termux to supported platforms and installation guide
- Gate pro-only public functions with #[cfg(feature = "pro")] to eliminate
  6 dead_code warnings in the standard build

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-01 19:57:18 +04:00
parent 817535a0ad
commit c06a4d0c9a
3 changed files with 53 additions and 1 deletions

View File

@@ -2,6 +2,25 @@
A Rust reimplementation of the [MikroTik Bandwidth Test (btest)](https://wiki.mikrotik.com/wiki/Manual:Tools/Bandwidth_Test) protocol. Both server and client modes, fully compatible with MikroTik RouterOS devices. A Rust reimplementation of the [MikroTik Bandwidth Test (btest)](https://wiki.mikrotik.com/wiki/Manual:Tools/Bandwidth_Test) protocol. Both server and client modes, fully compatible with MikroTik RouterOS devices.
## Free Public Servers
Test your MikroTik link speed right now — no setup, no registration:
| Server | Location | Dashboard |
|--------|----------|-----------|
| `104.225.217.60` | US | [btest.home.kg](https://btest.home.kg) |
| `188.245.59.196` | EU | [btest.mikata.ru](https://btest.mikata.ru) |
```
/tool bandwidth-test address=104.225.217.60 user=btest password=btest protocol=tcp direction=both
```
After the test, visit `https://btest.home.kg/dashboard/YOUR_IP` to see your results, throughput history, and quota usage. Per-IP limits: 2 GB daily / 8 GB weekly / 24 GB monthly.
> **Note:** TCP is recommended for remote testing. UDP bidirectional through NAT will only show one direction — this is a btest protocol limitation, not specific to btest-rs. See [KNOWN_ISSUES.md](KNOWN_ISSUES.md) for details.
Want to run your own public server? Build with `cargo build --release --features pro` — see [Server Pro](#server-pro) below.
## Features ## Features
- **Full protocol support** -- TCP and UDP data transfer, IPv4 and IPv6 - **Full protocol support** -- TCP and UDP data transfer, IPv4 and IPv6
@@ -16,7 +35,7 @@ A Rust reimplementation of the [MikroTik Bandwidth Test (btest)](https://wiki.mi
- **Quiet mode** -- suppress terminal output for scripted/automated use - **Quiet mode** -- suppress terminal output for scripted/automated use
- **NAT traversal** -- probe packet to open firewall holes for UDP receive - **NAT traversal** -- probe packet to open firewall holes for UDP receive
- **Single static binary** -- ~2 MB, zero runtime dependencies (musl build) - **Single static binary** -- ~2 MB, zero runtime dependencies (musl build)
- **Cross-platform** -- macOS, Linux (x86_64, ARM64), Docker - **Cross-platform** -- macOS, Linux (x86_64, ARM64, ARMv7), Windows, Android (Termux), Docker
- **Async I/O** -- tokio-based, handles many concurrent connections efficiently - **Async I/O** -- tokio-based, handles many concurrent connections efficiently
## Performance ## Performance
@@ -61,6 +80,10 @@ sudo mv btest /usr/local/bin/
# Windows # Windows
# Download btest-windows-x86_64.zip from releases # Download btest-windows-x86_64.zip from releases
# Android (Termux, no root needed)
curl -L <release-url>/btest-android-aarch64.tar.gz | tar xz
mv btest $PREFIX/bin/
``` ```
### Raspberry Pi ### Raspberry Pi
@@ -267,6 +290,29 @@ scripts/test-mikrotik.sh <ip> # Test against MikroTik device
scripts/test-docker.sh # Docker container test scripts/test-docker.sh # Docker container test
``` ```
## Server Pro
An optional superset of the standard server with multi-user support, quotas, and a web dashboard. Build with `--features pro`:
```bash
cargo build --release --features pro --bin btest-server-pro
```
Features:
- **SQLite user database** — add/remove users, per-user quotas
- **Per-IP bandwidth quotas** — daily, weekly, monthly limits with inline byte budget enforcement
- **Web dashboard** — session history, throughput stats, quota progress bars, JSON export
- **TCP multi-connection** — handles MikroTik's default 20-connection mode
- **MD5 auth against DB** — proper challenge-response verification
```bash
# Create a user and start the server
btest-server-pro --users-db users.db useradd btest btest
btest-server-pro --users-db users.db --ip-daily 2147483648 --ip-weekly 8589934592 --web-port 8080
```
The pro features are completely optional and don't affect the standard `btest` binary.
## Credits ## Credits
- **[btest-opensource](https://github.com/samm-git/btest-opensource)** by [Alex Samorukov](https://github.com/samm-git) -- original C implementation and protocol reverse-engineering. Licensed under **MIT**. - **[btest-opensource](https://github.com/samm-git/btest-opensource)** by [Alex Samorukov](https://github.com/samm-git) -- original C implementation and protocol reverse-engineering. Licensed under **MIT**.

View File

@@ -73,6 +73,7 @@ impl BandwidthState {
} }
/// Set the byte budget (total bytes allowed for the entire test). /// Set the byte budget (total bytes allowed for the entire test).
#[cfg(feature = "pro")]
pub fn set_budget(&self, budget: u64) { pub fn set_budget(&self, budget: u64) {
self.byte_budget.store(budget, std::sync::atomic::Ordering::SeqCst); self.byte_budget.store(budget, std::sync::atomic::Ordering::SeqCst);
} }

View File

@@ -367,6 +367,7 @@ async fn handle_client(
// --- TCP Test Server --- // --- TCP Test Server ---
/// Public TX task for multi-connection use by server_pro. /// Public TX task for multi-connection use by server_pro.
#[cfg(feature = "pro")]
pub async fn tcp_tx_task( pub async fn tcp_tx_task(
writer: tokio::net::tcp::OwnedWriteHalf, writer: tokio::net::tcp::OwnedWriteHalf,
tx_size: usize, tx_size: usize,
@@ -377,6 +378,7 @@ pub async fn tcp_tx_task(
} }
/// Public RX task for multi-connection use by server_pro. /// Public RX task for multi-connection use by server_pro.
#[cfg(feature = "pro")]
pub async fn tcp_rx_task( pub async fn tcp_rx_task(
reader: tokio::net::tcp::OwnedReadHalf, reader: tokio::net::tcp::OwnedReadHalf,
state: Arc<BandwidthState>, state: Arc<BandwidthState>,
@@ -386,6 +388,7 @@ pub async fn tcp_rx_task(
/// Run a TCP bandwidth test on an already-authenticated stream. /// Run a TCP bandwidth test on an already-authenticated stream.
/// Public API for use by server_pro. /// Public API for use by server_pro.
#[cfg(feature = "pro")]
pub async fn run_tcp_test( pub async fn run_tcp_test(
stream: TcpStream, stream: TcpStream,
cmd: Command, cmd: Command,
@@ -470,6 +473,7 @@ async fn run_tcp_test_inner(stream: TcpStream, cmd: Command, state: Arc<Bandwidt
} }
/// Public API for multi-connection TCP test with external state. Used by server_pro. /// Public API for multi-connection TCP test with external state. Used by server_pro.
#[cfg(feature = "pro")]
pub async fn run_tcp_multiconn_test( pub async fn run_tcp_multiconn_test(
streams: Vec<TcpStream>, streams: Vec<TcpStream>,
cmd: Command, cmd: Command,
@@ -686,6 +690,7 @@ async fn tcp_status_sender(
/// Run a UDP bandwidth test on an already-authenticated stream. /// Run a UDP bandwidth test on an already-authenticated stream.
/// Public API for use by server_pro. Caller provides the UDP port offset. /// Public API for use by server_pro. Caller provides the UDP port offset.
#[cfg(feature = "pro")]
pub async fn run_udp_test( pub async fn run_udp_test(
stream: &mut TcpStream, stream: &mut TcpStream,
peer: SocketAddr, peer: SocketAddr,