Watch
1
0
Fork
You've already forked icann-rdap-client
0
No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Baumann 688e2df1d1
Releasing debian version 0.0.31-1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2026-08-09 07:57:01 +02:00
debian Releasing debian version 0.0.31-1. 2026-08-09 07:57:01 +02:00
src Merging upstream version 0.0.31. 2026-08-06 21:50:06 +02:00
.cargo_vcs_info.json Merging upstream version 0.0.31. 2026-08-06 21:50:06 +02:00
Cargo.lock Merging upstream version 0.0.31. 2026-08-06 21:50:06 +02:00
Cargo.toml Merging upstream version 0.0.31. 2026-08-06 21:50:06 +02:00
Cargo.toml.orig Merging upstream version 0.0.31. 2026-08-06 21:50:06 +02:00
README.md Merging upstream version 0.0.30. 2026-07-09 19:03:51 +02:00

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. Read about ICANN's role in RDAP. See general information on RDAP.

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 this crate 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::prelude::*;
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();
    // or let config = ClientConfig::builder().build();

    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::prelude::*;
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::builder().build();
    // or 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(())
}

Using strum

This project uses the strum crate to provide many compile-time utilities for enums. To avoid conflicts with the macros used by strum, this project uses strums "derive" feature. Code depending on this project are recommended to do the same.

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 ICANNs option, without any additional terms or conditions.