12 releases

0.0.19 Dec 3, 2024
0.0.18 Sep 6, 2024
0.0.17 Aug 28, 2024
0.0.16 Mar 15, 2024
0.0.12 Jul 14, 2023

#4 in #rdap

Download history 126/week @ 2024-08-26 129/week @ 2024-09-02 8/week @ 2024-09-09 31/week @ 2024-09-16 32/week @ 2024-09-23 11/week @ 2024-09-30 7/week @ 2024-10-07 5/week @ 2024-10-14 9/week @ 2024-10-28 8/week @ 2024-11-04 4/week @ 2024-11-18 159/week @ 2024-12-02 37/week @ 2024-12-09

200 downloads per month
Used in 2 crates

MIT/Apache

520KB
13K SLoC

ICANN RDAP Client Library

This is a client library for the Registration Data Access Protocol (RDAP) written and sponsored by the Internet Corporation for Assigned Names and Numbers (ICANN). RDAP is standard of the IETF, and extensions to RDAP are a current work activity of the IETF's REGEXT working group. More information on ICANN's role in RDAP can be found here. General information on RDAP can be found here.

Installation

Add the library to your Cargo.toml: cargo add icann-rdap-client

Also, add the commons library: cargo add icann-rdap-common.

Both icann-rdap-common and icann-rdap-client can be compiled for WASM targets.

Usage

In RDAP, bootstrapping is the process of finding the authoritative RDAP server to query using the IANA RDAP bootstrap files. To make a query using bootstrapping:

use icann_rdap_client::*;
use std::str::FromStr;
use tokio::main;

#[tokio::main]
async fn main() -> Result<(), RdapClientError> {

    // create a query
    let query = QueryType::from_str("192.168.0.1")?;
    // or
    let query = QueryType::from_str("icann.org")?;

    // create a client (from icann-rdap-common)
    let config = ClientConfig::default();
    let client = create_client(&config)?;
    // ideally, keep store in same context as client
    let store = MemoryBootstrapStore::new();

    // issue the RDAP query
    let response =
        rdap_bootstrapped_request(
           &query,
           &client,
           &store,
           |reg| eprintln!("fetching {reg:?}")
    ).await?;

    Ok(())
}

To specify a base URL:

use icann_rdap_client::*;
use std::str::FromStr;
use tokio::main;

#[tokio::main]
async fn main() -> Result<(), RdapClientError> {

    // create a query
    let query = QueryType::from_str("192.168.0.1")?;
    // or
    let query = QueryType::from_str("icann.org")?;

    // create a client (from icann-rdap-common)
    let config = ClientConfig::default();
    let client = create_client(&config)?;

    // issue the RDAP query
    let base_url = "https://rdap-bootstrap.arin.net/bootstrap";
    let response = rdap_request(base_url, &query, &client).await?;

    Ok(())
}

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution, as defined in the Apache-2.0 license, intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed pursuant to the Apache License, Version 2.0 or the MIT License referenced as above, at ICANN’s option, without any additional terms or conditions.

Dependencies

~13–29MB
~482K SLoC