tur-rs is a reusable download core that can be embedded as a Rust library or used via its CLI/TUI binary. It uses adaptive work-stealing, protocol-aware scheduling, and platform-optimised storage backends to saturate your bandwidth with a minimal memory footprint (~15 MB).
Features
| Layer | Capability |
|---|---|
| Protocol | HTTP/1.1, HTTP/2, HTTP/3 (experimental) with auto-negotiation |
| Scheduling | Dynamic range stealing with Fibonacci, equal, or adaptive chunking |
| Storage | Aligned I/O, splice (Linux), direct I/O, Windows overlapped |
| Scaling | Adaptive connection management from real-time throughput signals |
| CLI | Full terminal UI (ratatui) or headless mode for scripting |
| Library | Embeddable via TurService facade — see examples/embed.rs |
Library embedding
Add tur-rs to your Cargo.toml:
[]
= { = "https://github.com/greykaizen/tur-rs" }
Then use the TurService facade:
use LocalSet;
use ;
let local = new;
local.run_until.await;
See examples/embed.rs for a complete runnable example.
CLI usage
# Install the binary
# Download a file
# With 16 connections, 2 concurrent tasks, in the background
Core options
| Flag | Description | Default |
|---|---|---|
-u, --url <URL> |
Target URL(s) to download | required |
-d, --dir <DIR> |
Output directory | . |
-c, --connections <N> |
Connections per download | 8 |
-t, --tasks <N> |
Concurrent downloads | 3 |
--headless |
Run without TUI | false |
--http-mode <MODE> |
Force HTTP mode (auto, http1, http2, http3) |
auto |
--schedule-mode <MODE> |
Chunking algorithm (equal, fib) |
fib |
Run tur --help for the full list.
Feature flags
| Feature | Default | Description |
|---|---|---|
tui |
✓ | Terminal UI (ratatui, crossterm) |
http3 |
Experimental HTTP/3 via QUIC | |
linux-io-uring-experimental |
Linux io_uring storage |
Benchmarks
Tur matches the speed of established tools while using significantly less memory.
Project structure
src/
├── lib.rs # Library crate root (stable API re-exports)
├── main.rs # Thin binary bootstrap
├── cli.rs # CLI argument parsing (clap)
├── connector.rs # Platform-adaptive TCP connector
├── engine.rs # Core engine: scheduling, scaling, lifecycle
├── engine/ # Engine sub-modules
│ ├── coordinator/ # Range coordination & state tracking
│ ├── http/ # HTTP client construction & protocol helpers
│ ├── metrics/ # Scheduler metrics counters
│ ├── runtime/ # DownloadEngine runtime & event dispatch
│ ├── scaler/ # Adaptive connection scaler
│ ├── types/ # Shared type definitions
│ ├── worker/ # Per-connection worker logic
│ ├── helpers.rs # Statistical & helper functions
│ ├── origin_memory.rs
│ ├── persistence.rs
│ └── ranges.rs
├── quic.rs # HTTP/3 client (feature-gated)
├── service.rs # TurService facade for library embedding
├── storage.rs # Platform storage backends
└── tui/ # Terminal UI (feature-gated)
├── app.rs
├── input.rs
└── render.rs
Stability
The types re-exported from the crate root (TurService, ServiceConfig,
DownloadRequest, DownloadHandle, DownloadUpdate, DownloadStatus,
HttpMode, ScheduleMode, StorageConfig) form the stable public API
and follow semantic versioning.
Internal modules (engine, connector, quic, storage, cli, tui) are
exposed for advanced use but may change between minor releases.
License
GNU General Public License v3.0 — see LICENSE.