| Crates.io | czdb |
| lib.rs | czdb |
| version | 0.1.4 |
| created_at | 2024-11-21 04:08:59.367155+00 |
| updated_at | 2025-09-06 11:31:22.396746+00 |
| description | A pure Rust library for parsing CZDB-format IP databases. |
| homepage | |
| repository | https://github.com/AldenClark/czdb-rs |
| max_upload_size | |
| id | 1455686 |
| size | 39,736 |
czdb-rs is a lightweight Rust library for querying CZDB-format IP geolocation databases. It supports both IPv4 and IPv6 lookups and provides multiple loading strategies for different performance needs.
mmap featureThe database file and key must be obtained from www.cz88.net.
cargo add czdb
use czdb::Czdb;
use std::net::IpAddr;
let db = Czdb::new("path/to/your/czdb_file", "your_base64_key")?;
let ip: IpAddr = "8.8.8.8".parse().unwrap();
if let Some(location) = db.search(ip) {
println!("Location for {}: {}", ip, location);
}
# Ok::<(), Box<dyn std::error::Error>>(())
For the Chinese version of this document, see README.zh.md.