czdb

Crates.ioczdb
lib.rsczdb
version0.1.1
sourcesrc
created_at2024-11-21 04:08:59.367155
updated_at2024-11-23 02:17:07.103806
descriptionA pure Rust library for parsing CZDB-format IP databases.
homepage
repositoryhttps://github.com/AldenClark/czdb-rs
max_upload_size
id1455686
size20,453
Alden Clark (AldenClark)

documentation

https://docs.rs/czdb

README

czdb-rs

Crates.io Documentation MIT licensed

czdb-rs is a simple and fast Rust library for parsing CZDB-format IP databases. It supports both IPv4 and IPv6 lookups and uses memory-mapped files (mmap) to keep memory usage low and speed up disk access. Perfect for quick IP geolocation queries with minimal overhead.

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

Usage

cargo add czdb
use czdb::Czdb;

let db_path = "path/to/your/czdb_file";
let key = "your_base64_key";
let czdb = Czdb::new(db_path, key).expect("Failed to load database");
use std::net::IpAddr;
let ip: IpAddr = "8.8.8.8".parse().unwrap();
if let Some(location) = czdb.search(ip) {
    println!("Location for IP {}: {}", ip, location);
} else {
    println!("No location data found for IP {}", ip);
}
Commit count: 7

cargo fmt