Crate whois_rust[][src]

Expand description


This is a WHOIS client library for Rust, inspired by


You can make a servers.json file or copy one from

This is a simple example of servers.json.

    "org": "",
    "": "",
    "_": {
        "ip": {
            "host": "",
            "query": "n + $addr\r\n"

Then, use the from_path (or from_string if your JSON data is in-memory) associated function to create a WhoIs instance.

extern crate whois_rust;

use whois_rust::WhoIs;

let whois = WhoIs::from_path("/path/to/servers.json").unwrap();

Use the lookup method and input a WhoIsLookupOptions instance to lookup a domain or an IP.

extern crate whois_rust;

use whois_rust::{WhoIs, WhoIsLookupOptions};

let whois = WhoIs::from_path("/path/to/servers.json").unwrap();

let result: String = whois.lookup(WhoIsLookupOptions::from_string("").unwrap()).unwrap();

Asynchronous APIs

You may want to use async APIs with your async runtime. This crate supports tokio, currently.

version = "*"
features = ["tokio"]

After enabling the async feature, the from_path_async function and the lookup_async function are available.


git clone --recurse-submodules git://

cd whois-rust

cargo test


pub extern crate tokio;


The WhoIs structure stores the list of WHOIS servers in-memory.

The options about how to lookup.

The model of a WHOIS server.