Skip to main content

Crate turbo_cdn

Crate turbo_cdn 

Source
Expand description

§Turbo CDN

Intelligent download accelerator with automatic CDN optimization and concurrent chunked downloads.

§Features

  • Automatic CDN Optimization: GitHub, jsDelivr, Fastly, Cloudflare mirrors
  • Concurrent Downloads: Multi-threaded chunked downloads with range requests
  • Smart URL Mapping: Regex-based URL pattern matching for CDN selection
  • Resume Support: Automatic resume for interrupted downloads
  • Geographic Awareness: Location-based CDN selection for optimal speed
  • Progress Tracking: Real-time download progress and speed monitoring

§Quick Start

use turbo_cdn::*;

#[tokio::main]
async fn main() -> turbo_cdn::Result<()> {
    // Simple download with automatic CDN optimization
    let downloader = TurboCdn::new().await?;
     
    let result = downloader.download_from_url(
        "https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-pc-windows-msvc.zip"
    ).await?;
     
    println!("Downloaded {} bytes to: {}", result.size, result.path.display());
    println!("Speed: {:.2} MB/s", result.speed / 1024.0 / 1024.0);
    Ok(())
}

Re-exports§

pub use concurrent_downloader::ConcurrentDownloader;
pub use concurrent_downloader::DownloadResult;
pub use config::Region;
pub use config::TurboCdnConfig;
pub use error::Result;
pub use error::TurboCdnError;
pub use github_releases::AssetInfo;
pub use github_releases::DataSource;
pub use github_releases::FetchOptions;
pub use github_releases::GitHubReleasesFetcher;
pub use github_releases::ReleaseInfo;
pub use github_releases::ReleasesResult;
pub use github_releases::VersionsResult;
pub use progress::ConsoleProgressReporter;
pub use progress::ProgressCallback;
pub use progress::ProgressInfo;
pub use progress::ProgressTracker;
pub use server_tracker::PerformanceSummary;
pub use server_tracker::ServerStats;
pub use url_mapper::UrlMapper;
pub use constants::*;

Modules§

adaptive_concurrency
Adaptive Concurrency Control System
adaptive_speed_controller
Adaptive speed controller with dynamic optimization
async_api
Async API module for external integrations (like vx)
cdn_quality
CDN Quality Assessment and Real-time Performance Monitoring
cli_progress
CLI progress display utilities using indicatif
concurrent_downloader
Concurrent download engine with dynamic segmentation
config
Configuration System
constants
Constants
dns_cache
DNS Cache System
error
geo_detection
Geographic Location Detection
github_releases
GitHub Releases version listing API with CDN fallback
http_client
HTTP client implementation using reqwest with rustls
http_client_manager
HTTP client manager using reqwest with rustls
load_balancer
Intelligent Load Balancer
logging
Professional logging configuration for turbo-cdn
memory_tracker
Memory usage tracking and metrics
mmap_writer
Memory-mapped file writer for high-performance I/O
progress
server_quality_scorer
Server quality scoring and intelligent failover system
server_tracker
Server performance tracking and intelligent selection
smart_chunking
Smart Chunking Algorithm
smart_downloader
Smart downloader with automatic method selection
string_interner
String interning system for frequently used URLs and patterns
sync_api
Synchronous API for blocking operations
url_mapper
URL mapping system for CDN optimization

Macros§

api_debug
api_info
cli_error
cli_info
Logging macros for different contexts
cli_warn

Structs§

DownloadOptions
Download options for customizing download behavior
TurboCdn
Main TurboCdn client - simplified download accelerator
TurboCdnBuilder
Builder for TurboCdn with fluent API
TurboCdnStats
Statistics for TurboCdn

Functions§

init_rustls_provider
Initialize rustls crypto provider (ring backend) This must be called before creating any reqwest Client when using rustls-no-provider
init_tracingDeprecated
Initialize tracing for the library (deprecated - use logging module)
init_tracing_with_levelDeprecated
Initialize tracing with specific level (deprecated - use logging module)