whoizz
A tiny, dependency-light RFC 3912
whois client for Rust. Supports both domain whois (via TLD registries)
and IP whois (via the Regional Internet Registries — ARIN, RIPE,
APNIC, LACNIC, AFRINIC). Queries IANA for the authoritative server,
follows the refer: line, and returns both the raw response and a
best-effort extraction of the common fields (registrar,
creation/expiry dates, name servers).
No async runtime, no custom protocol crates — just std::net::TcpStream
and thiserror.
Usage
Domain lookup
use lookup;
IP lookup
use IpAddr;
use lookup_ip;
What it does
- Extracts the TLD from the input domain.
- Queries
whois.iana.orgto discover the authoritative whois server for that TLD (therefer:line in the IANA response). - Opens a TCP connection to the referred server on port 43, sends
<domain>\r\n, reads the response until EOF. - Parses the free-text response heuristically to extract the common
fields. Whois responses are not standardized across registries,
so field extraction is best-effort — the
rawfield always contains the full response if you need to parse more yourself.
Limitations
- Best-effort parsing. Registrars format their responses however they like. If a field is missing or formatted oddly, it won't be extracted. The raw response is always available.
- Blocking I/O only. If you need async, wrap the call in
tokio::task::spawn_blockingor equivalent. - Rate limits apply. Most whois servers rate-limit queries per IP. Don't hammer them.
- Private / reserved IP ranges (RFC 1918, CGNAT, loopback, etc.) return whichever response the RIR gives — usually a reservation notice rather than a registration record. Filter client-side if you only want public IPs.
License
MIT — see LICENSE.