18 releases (7 breaking)
| new 0.8.2 | Feb 13, 2026 |
|---|---|
| 0.7.1 | Jan 3, 2026 |
| 0.6.1 | Dec 29, 2025 |
| 0.4.3 | Jul 3, 2025 |
#230 in Network programming
2,181 downloads per month
Used in 3 crates
(2 directly)
410KB
9K
SLoC
Turbo CDN
中文文档 | English | 📖 Documentation
Next-generation intelligent download accelerator with automatic geographic detection, real-time CDN quality assessment, and comprehensive mirror optimization for 6+ package managers.
✨ Features
-
🌐 Intelligent Geographic Detection - Auto-region detection with multiple API fallbacks
-
📊 Real-time CDN Quality Assessment - Continuous monitoring with dynamic ranking
-
⚡ High-Performance Architecture - mimalloc, reqwest + rustls, adaptive concurrency
-
🔗 Multi-CDN Mirror Coverage - GitHub, PyPI, Crates.io, npm, Docker Hub, Maven, and more
-
🧠 Smart Download Mode - Automatic method selection based on performance testing
-
🔄 Resume Support - Robust resume capability for interrupted downloads
📖 Read the full documentation for detailed guides and API reference.
🚀 Quick Start
Installation
# From crates.io
cargo install turbo-cdn
# Or from source
git clone https://github.com/loonghao/turbo-cdn.git
cd turbo-cdn
cargo build --release
CLI Usage
# Smart download (default - auto-selects best method)
turbo-cdn dl "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-pc-windows-msvc.zip"
# Get optimized CDN URL
turbo-cdn optimize "https://github.com/user/repo/releases/download/v1.0/file.zip"
# Download with verbose output
turbo-cdn dl "https://example.com/file.zip" --verbose
# View performance statistics
turbo-cdn stats
Optional self-update command: enable during install with cargo install turbo-cdn --features self-update to use turbo-cdn self-update / turbo-cdn upgrade.
Stats command status: currently prints a readiness summary; detailed metrics will ship in upcoming releases.
Library Usage
use turbo_cdn::*;
#[tokio::main]
async fn main() -> turbo_cdn::Result<()> {
let downloader = TurboCdn::new().await?;
let result = downloader.download_from_url(
"https://github.com/user/repo/releases/download/v1.0/file.zip"
).await?;
println!("Downloaded {} bytes at {:.2} MB/s",
result.size, result.speed / 1024.0 / 1024.0);
Ok(())
}
Feature Flags
[dependencies]
# Library-friendly defaults (self-update off, rustls ring backend - no cmake/NASM needed)
turbo-cdn = { version = "0.8", features = ["rustls", "fast-hash", "high-performance"] }
# CLI build with self-update enabled
turbo-cdn = { version = "0.8", default-features = false, features = ["rustls", "fast-hash", "high-performance", "self-update"] }
# Use native TLS (SChannel on Windows, Secure Transport on macOS) - no rustls dependencies
turbo-cdn = { version = "0.8", default-features = false, features = ["native-tls", "fast-hash", "high-performance"] }
| Feature | Default | Description |
|---|---|---|
rustls |
Yes | TLS via rustls with ring backend (no cmake/NASM toolchain required). Includes rustls and rustls-webpki dependencies. |
native-tls |
No | Use native TLS (SChannel on Windows, Secure Transport on macOS). Does NOT pull in rustls dependencies. |
fast-hash |
Yes | Use ahash for faster hashing |
high-performance |
Yes | Enable high-performance optimizations |
self-update |
No | CLI self-update functionality (opt-in for binaries) |
Note for downstream crates: When using
native-tlsfeature,rustlsandrustls-webpkiare NOT included as dependencies. This allows downstream crates to use their own TLS configuration without conflicts.
📊 Supported Package Managers
| Package Manager | Mirrors | Regions |
|---|---|---|
| GitHub | 7 mirrors | China, Asia, Global |
| Microsoft Visual Studio downloads | Direct + configurable mirrors | Global |
| Python PyPI | Tsinghua, Aliyun, Douban | China |
| Rust Crates | Tsinghua, USTC | China |
| Go Modules | goproxy.cn, Aliyun | China |
| Docker Hub | USTC, NetEase, Docker China | China |
| Maven Central | Aliyun, Tsinghua | China |
| jsDelivr | 5 global CDN nodes | Global |
📖 Documentation
- Getting Started - Introduction and quick start
- Installation - Detailed installation options
- Geographic Detection - How region detection works
- CDN Quality Assessment - Understanding quality scoring
- Smart Download - Automatic method selection
- API Reference - Complete API documentation
🏗️ Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Input URL │───▶│ Geographic │───▶│ CDN Quality │
│ │ │ Detection │ │ Assessment │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ URL Mapper │ │ Smart Download │ │ Adaptive │
│ (16+ Rules) │ │ Selection │ │ Concurrency │
└─────────────────┘ └──────────────────┘ └─────────────────┘
🛡️ Compliance
- ✅ Open Source Software (MIT, Apache, GPL, BSD, etc.)
- ✅ Public Domain (CC0, Unlicense, etc.)
- ❌ Proprietary/Commercial software not supported
- 📋 GDPR/CCPA compliant with minimal data collection
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
# Development setup
git clone https://github.com/loonghao/turbo-cdn.git
cd turbo-cdn
cargo build
cargo test
cargo clippy
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- reqwest - High-performance HTTP client
- mimalloc - High-performance memory allocator
- tokio - Async runtime
- clap - Command line parsing
📞 Support
Dependencies
~43–69MB
~1.5M SLoC