ngdp-cdn
CDN client for downloading NGDP (Next Generation Distribution Pipeline) content from Blizzard's CDN servers.
Features
- 🚀 Async/await - Built on Tokio for high-performance async I/O
- 🔄 Automatic retry - Configurable exponential backoff with jitter
- 🏊 Connection pooling - Efficient reuse of connections for multiple downloads
- 🗜️ Compression support - Automatic gzip/deflate decompression
- ⚡ Concurrent downloads - Download multiple files in parallel
- 🛡️ Error handling - Comprehensive error types for CDN operations
- ⏱️ Configurable timeouts - Separate connection and request timeouts
Usage
Add this to your Cargo.toml:
[]
= "0.1"
Basic Example
use CdnClient;
async
Advanced Configuration
use CdnClient;
let client = builder
.max_retries
.initial_backoff_ms
.max_backoff_ms
.connect_timeout
.request_timeout
.pool_max_idle_per_host
.build?;
CDN URL Structure
NGDP CDN URLs follow a specific pattern for content addressing:
http://{cdn_host}/{path}/{hash[0:2]}/{hash[2:4]}/{hash}
For example:
- Hash:
2e9c1e3b5f5a0c9d9e8f1234567890ab - CDN Host:
blzddist1-a.akamaihd.net - Path:
tpr/wow - Results in:
http://blzddist1-a.akamaihd.net/tpr/wow/2e/9c/2e9c1e3b5f5a0c9d9e8f1234567890ab
Error Handling
The crate provides specific error types for CDN operations:
use Error;
match client.download.await
Integration with NGDP
This crate is designed to work with other NGDP components:
- Use
ribbit-clientto get CDN configuration - Use
tact-clientto get content manifests - Use
ngdp-cdnto download the actual content
// Example workflow (simplified)
let ribbit = new;
let cdns = ribbit.get_product_cdns.await?;
let tact = new?;
let versions = tact.get_versions_parsed.await?;
let cdn_client = new?;
for host in cdns.hosts
Performance Considerations
- Connection pooling: The client maintains a pool of connections to each host
- Concurrent downloads: Use multiple client instances or clone the client for parallel downloads
- Retry strategy: Configure retry parameters based on your network conditions
- Timeouts: Adjust timeouts based on file sizes and network speed
📄 License
This project is dual-licensed under either:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
🫶 Acknowledgments
This crate is part of the cascette-rs project, providing tools for World of Warcraft
emulation development.