turbo-cdn

Crates.ioturbo-cdn
lib.rsturbo-cdn
version0.8.1
created_at2025-06-20 13:47:53.727698+00
updated_at2026-01-10 14:22:17.295733+00
descriptionIntelligent download accelerator with automatic CDN optimization and concurrent chunked downloads
homepagehttps://github.com/loonghao/turbo-cdn
repositoryhttps://github.com/loonghao/turbo-cdn
max_upload_size
id1719666
size830,457
Hal (loonghao)

documentation

https://docs.rs/turbo-cdn

README

Turbo CDN

Crates.io Documentation License: MIT Build Status Security Audit codecov Downloads MSRV GitHub release GitHub stars

δΈ­ζ–‡ζ–‡ζ‘£ | 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"] }

# Windows-friendly native TLS (SChannel) if you prefer not to use rustls
turbo-cdn = { version = "0.8", default-features = false, features = ["native-tls", "fast-hash", "high-performance"] }

Feature Default Description
rustls Yes TLS via rustls (ring backend, no cmake/NASM toolchain required)
native-tls No Use native TLS (SChannel/Secure Transport) instead of rustls
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)

πŸ“Š 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

πŸ—οΈ 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


Made with ❀️ for the open source community
Commit count: 144

cargo fmt