ngdp_cdn/lib.rs
1//! NGDP CDN client for downloading game content
2//!
3//! This crate provides an async HTTP client specifically designed for downloading
4//! content from Blizzard's CDN servers. It includes:
5//!
6//! - Connection pooling for efficient multiple downloads
7//! - Automatic retry with exponential backoff
8//! - Support for gzip/deflate compression
9//! - Configurable timeouts and retry policies
10//!
11//! # Example
12//!
13//! ```no_run
14//! use ngdp_cdn::CdnClient;
15//!
16//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
17//! // Create a CDN client with default configuration
18//! let client = CdnClient::new()?;
19//!
20//! // Download a file by hash
21//! let response = client.download(
22//! "blzddist1-a.akamaihd.net",
23//! "tpr/wow",
24//! "2e9c1e3b5f5a0c9d9e8f1234567890ab",
25//! ).await?;
26//!
27//! let content = response.bytes().await?;
28//! println!("Downloaded {} bytes", content.len());
29//! # Ok(())
30//! # }
31//! ```
32//!
33//! # Advanced Configuration
34//!
35//! ```no_run
36//! use ngdp_cdn::CdnClient;
37//!
38//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
39//! // Create a client with custom retry configuration
40//! let client = CdnClient::builder()
41//! .max_retries(5)
42//! .initial_backoff_ms(200)
43//! .max_backoff_ms(30_000)
44//! .connect_timeout(60)
45//! .pool_max_idle_per_host(50)
46//! .build()?;
47//! # Ok(())
48//! # }
49//! ```
50
51#![warn(missing_docs)]
52
53mod client;
54mod error;
55
56#[cfg(test)]
57mod client_test;
58
59pub use client::{CdnClient, CdnClientBuilder};
60pub use error::{Error, Result};