| Crates.io | whois-that |
| lib.rs | whois-that |
| version | 0.1.2 |
| created_at | 2025-07-24 20:47:54.338848+00 |
| updated_at | 2025-08-02 05:32:46.929644+00 |
| description | A feature full whois client library with support for non-UTF8 responses |
| homepage | |
| repository | https://github.com/supercoolspy/whois-that |
| max_upload_size | |
| id | 1766907 |
| size | 61,303 |
whois-that is a fast, asynchronous WHOIS client library for Rust using tokio. It provides comprehensive domain information lookups with support for international domains, custom server lists, and various character encodings.
Add this to your Cargo.toml:
[dependencies]
whois-that = "0.1"
tokio = { version = "1", features = ["full"] }
The library uses feature flags to provide flexibility:
| Flag | Description | Default |
|---|---|---|
serde |
Enable serde support for loading server lists from files/JSON data | ✓ |
idna |
Enable IDNA support for international domain names | ✓ |
decode-global |
Enable Windows-1252 character encoding support | ✓ |
To use only specific features:
[dependencies]
whois-that = { version = "0.1", default-features = false, features = ["serde", "idna"] }
use whois_that::whois::Whois;
use whois_that::builder::WhoisBuilder;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a default whois client with built-in server list
let whois = WhoisBuilder::default().build()?;
// Look up WHOIS data for a domain
let whois_data = whois.whois_lookup("google.com").await?;
println!("{}", whois_data);
Ok(())
}
You can provide your own WHOIS server list as a JSON file:
use whois_that::whois::Whois;
use whois_that::builder::WhoisBuilder;
use std::path::Path;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a whois client with a custom server list
let whois = WhoisBuilder::default()
.with_server_path(Path::new("path/to/custom_servers.json"))
.build()?;
// Look up WHOIS data for a domain
let whois_data = whois.whois_lookup("example.com").await?;
println!("{}", whois_data);
Ok(())
}
When the idna feature is enabled (on by default), you can lookup international domain names:
use whois_that::whois::Whois;
use whois_that::builder::WhoisBuilder;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let whois = WhoisBuilder::default().build()?;
// Look up WHOIS data for an IDN domain
let whois_data = whois.whois_lookup("例子.网址").await?;
println!("{}", whois_data);
Ok(())
}
Custom server lists should be JSON files in the following formats:
{
// Standard format
"io": "whois.nic.io",
// Detailed format
"net": {
"host": "whois.verisign-grs.com",
"query": "DOMAIN $addr\r\n",
"punycode": true
},
}
Contributions are welcome!