czdb

Crates.ioczdb
lib.rsczdb
version0.1.4
created_at2024-11-21 04:08:59.367155+00
updated_at2025-09-06 11:31:22.396746+00
descriptionA pure Rust library for parsing CZDB-format IP databases.
homepage
repositoryhttps://github.com/AldenClark/czdb-rs
max_upload_size
id1455686
size39,736
Alden Clark (AldenClark)

documentation

https://docs.rs/czdb

README

czdb-rs

Crates.io Documentation MIT licensed

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.

  • Buffered reader by default for low memory usage
  • Optional memory-mapped file loading via the mmap feature
  • Fully in-memory loading for fastest access

The database file and key must be obtained from www.cz88.net.

Usage

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.

Commit count: 18

cargo fmt