ribbit-client
Async TCP client for Blizzard's Ribbit protocol, used to retrieve version information, CDN configurations, and other metadata for Blizzard games.
Features
- 🚀 Async/await support - Built on Tokio for efficient async I/O
- 🌍 Multi-region support - US, EU, CN, KR, TW, SG regions
- 📝 Protocol versions - Both V1 (MIME) and V2 (raw PSV) protocols
- ✅ Checksum validation - SHA-256 integrity verification for V1 responses
- 🔐 Signature parsing - ASN.1/PKCS#7 signature extraction and validation
- 🛡️ Type-safe - Strongly typed endpoints and responses
- 📊 Comprehensive testing - Unit, integration, and benchmark tests
- 🎯 Production ready - Following Rust best practices with pedantic lints
Quick Start
Add to your Cargo.toml
:
[]
= "0.1"
= { = "1", = ["full"] }
Basic usage:
use ;
async
Supported Endpoints
Endpoint | Description | Example |
---|---|---|
Summary |
List all available products | client.request(&Endpoint::Summary) |
ProductVersions |
Get version info for a product | Endpoint::ProductVersions("wow".to_string()) |
ProductCdns |
Get CDN server information | Endpoint::ProductCdns("wow".to_string()) |
ProductBgdl |
Background download config | Endpoint::ProductBgdl("wow".to_string()) |
Cert |
Certificate by SHA-1 hash | Endpoint::Cert(hash.to_string()) |
Ocsp |
OCSP response by hash | Endpoint::Ocsp(hash.to_string()) |
Custom |
Any custom endpoint path | Endpoint::Custom("custom/path".to_string()) |
Protocol Versions
V1 Protocol (MIME)
- Full MIME message parsing with multipart support
- SHA-256 checksum validation from epilogue
- ASN.1 signature parsing for attached signatures
- Automatic content type detection
V2 Protocol (Raw PSV) - Default
- Direct PSV (Pipe-Separated Values) format
- Lower overhead, faster parsing
- No MIME wrapper or checksums
- This is the default protocol
// V2 is the default
let client = new;
// Or explicitly use V1 if needed
use ProtocolVersion;
let client = new
.with_protocol_version;
Examples
The crate includes several examples demonstrating different use cases:
# Basic client usage
# Parse version data into structured format
# Query multiple WoW products
# Debug MIME structure (V1 protocol)
# Typed API showcase
# Retry handling demonstration
Response Structure
Responses contain both raw data and parsed components:
Typed API (Recommended)
The client provides a typed API that automatically parses responses into strongly-typed structs:
// Get product versions with automatic parsing
let versions = client.get_product_versions.await?;
// Direct access to typed fields
for entry in &versions.entries
// Convenience methods
if let Some = versions.get_region
// Other typed endpoints
let summary = client.get_summary.await?;
let cdns = client.get_product_cdns.await?;
let bgdl = client.get_product_bgdl.await?;
Manual PSV Parsing (Advanced)
For custom endpoints or manual parsing, Ribbit returns data in PSV (Pipe-Separated Values) format:
// Manual parsing of raw response
let endpoint = ProductVersions;
let response = client.request.await?;
if let Some = response.data
Error Handling
The client provides detailed error types for different failure scenarios:
use ;
match client.request.await
Advanced Usage
Custom Region Configuration
let mut client = new;
client.set_region;
Raw Response Access
// Get raw bytes for custom parsing
let raw_data = client.request_raw.await?;
println!;
V1 Protocol with Signature Verification
use ProtocolVersion;
let client = new
.with_protocol_version;
let response = client.request.await?;
if let Some = response.mime_parts
Debugging
Enable trace logging to see detailed protocol information:
use EnvFilter;
fmt
.with_env_filter
.init;
Performance
The client is optimized for performance with:
- Reusable TCP connections per request
- Efficient MIME parsing with streaming support
- Zero-copy parsing where possible
- Async I/O for concurrent requests
Run benchmarks:
Testing
The crate includes comprehensive tests:
# Run all tests
# Run with trace logging
RUST_LOG=ribbit_client=trace
# Run specific test
Code Quality
This crate follows Rust best practices:
- Clippy pedantic lints enabled
- All public APIs documented with examples
#[must_use]
attributes where appropriate- Comprehensive error documentation
- No unsafe code
Contributing
Contributions are welcome! Please ensure:
- All tests pass
- Code follows Rust best practices
- Documentation is updated
- Examples demonstrate new features
📄 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.