Skip to main content

Crate whois_service

Crate whois_service 

Source
Expand description

§Whois Service Library

A high-performance, production-ready whois lookup library for Rust.

§Features

  • Hybrid TLD discovery: hardcoded mappings for popular TLDs + dynamic discovery
  • Intelligent whois server detection with fallback strategies
  • Structured data parsing with calculated fields (age, expiration)
  • Optional caching with smart domain normalization
  • Production-ready error handling with graceful degradation
  • High-performance async implementation with connection pooling

§Quick Start

use whois_service::WhoisClient;
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = WhoisClient::new().await?;
    let result = client.lookup("google.com").await?;
     
    println!("Domain: {}", result.domain);
    println!("Registrar: {:?}", result.parsed_data.as_ref().and_then(|p| p.registrar.as_ref()));
     
    Ok(())
}

Re-exports§

pub use whois::WhoisService;
pub use whois::WhoisResult;
pub use rdap::RdapService;
pub use rdap::RdapResult;
pub use cache::CacheService;
pub use config::Config;
pub use errors::WhoisError;
pub use tld::extract_tld;
pub use dates::parse_date;
pub use dates::calculate_date_fields;
pub use ip::ValidatedIpAddress;
pub use ip::Rir;
pub use ip::detect_rir;

Modules§

buffer_pool
cache
config
dates
Date parsing and calculation utilities
errors
ip
IP address validation and RIR (Regional Internet Registry) detection
parser
rate_limiter
rdap
RDAP (Registration Data Access Protocol) Service
tld
TLD (Top-Level Domain) extraction utilities
tld_mappings
whois

Structs§

LookupResult
Unified result type for both WHOIS and RDAP lookups
ParsedWhoisData
Parsed whois data structure with calculated fields
ValidatedDomain
Validated and normalized domain name.
ValidatedQuery
Unified validated query that auto-detects domain vs IP address
WhoisClient
High-level whois client with optional caching
WhoisResponse
Response structure for whois lookups

Enums§

DetectedQueryType
Detected query type (domain or IP address)