ICANN RDAP

repository·main·Indexed 19 days ago

https://github.com/icann/icann-rdap

An open-source implementation of the IETF Registry Data Access Protocol (RDAP). It provides a server implementation, a client library (icann-rdap-client), common components (icann-rdap-common), and a CLI package (icann-rdap-cli) featuring the `rdap` query client and `rdap-test` verification tool.

Tokens
49.1K
Snippets
128
Records
201
Agent score
66%

What's inside icann-rdap

  1. Overview of ICANN RDAP CLI commands

    main

    The icann-rdap-cli package provides two primary command-line tools for interacting with the Registration Data Access Protocol (RDAP):

    • rdap: A general-purpose RDAP command line client used for querying registration data.
    • rdap-test: A specialized testing tool designed for RDAP verification and testing.
  2. Understand ICANN RDAP versioning and breaking changes

    main

    The project follows Semantic Versioning (SemVer 2.0.0).

    Versioning Guidelines

    • MAJOR (X.0.0): Contains breaking public API changes, breaking CLI parameter changes, and increases to the Minimum Supported Rust Version (MSRV).
    • MINOR (0.Y.0): Adds new backwards-compatible features, deprecations, or non-breaking improvements.
    • PATCH (0.0.Z): Contains backwards-compatible fixes, internal code refactoring, documentation updates, and backwards-compatible updates to dependencies.

    Experimental Features

    Breaking changes may occur in experimental features that are not governed by the standard SemVer guidelines. These include:

    • Non-stable RDAP extensions (e.g., Exts, JSContact, and SimpleRedaction).
    • The SQLx server backend.

    User Interface Changes

    Non-parsable output formats are subject to change without notice. This includes:

    • Markdown and gTLD Whois output formats for rdap.
    • Text output for rdap-test.
  3. Manage contact information with the Contact struct

    main

    RDAP uses jCard (the JSON version of vCard) for contact information. The library provides a contact::Contact struct that simplifies this by allowing you to build contacts using a builder and converting them to/from jCard/vCard formats.

    Building and Serializing a Contact

    Use Contact::builder() to create a contact, then use .to_vcard() to get a serde_json::Value which can be serialized to JSON.

    use icann_rdap_common::contact::Contact;
    use serde::Serialize;
    use serde_json::Value;
    
    let contact = Contact::builder()
      .kind("individual")
      .full_name("Bob Smurd")
      .build();
    
    let v = contact.to_vcard();
    let json = serde_json::to_string(&v);

    Deserializing a Contact from jCard

    To deserialize, use Contact::from_vcard(&data) where data is a Vec<serde_json::Value> representing the jCard array.

    use icann_rdap_common::contact::Contact;
    use serde::Deserialize;
    use serde_json::Value;
    
    let json = r#"["vcard", [["version", {}, "text", "4.0"], ["fn", {}, "text", "Joe User"]]]"#;
    
    let data: Vec<Value> = serde_json::from_str(json).unwrap();
    let contact = Contact::from_vcard(&data);
  4. Quick Start with the icann-rdap-cli

    main

    The rdap command-line tool allows you to query RDAP (Registration Data Access Protocol) information for various network entities. You can perform lookups for domains, Top-Level Domains (TLDs), IP addresses, CIDR blocks, and Autonomous System Numbers (ASNs) by passing the identifier directly to the rdap command.

    # Domain lookup
    rdap example.com
    
    # TLD lookup
    rdap .com
    
    # IP Address lookup
    rdap 192.0.2.1
    
    # CIDR lookup
    rdap 10/8
    
    # ASN lookup
    rdap as64496
  5. Download geofeed files via RDAP

    main

    When using the Geofeed output type, the CLI identifies links with rel="geofeed" in the RDAP response (per RFC 9877). It then downloads these external resources (typically CSV files).

    Behavior:

    • If a specific file path is provided, the file is written directly to that location. If the file exists, content is appended with proper line endings.
    • If a directory path is provided, the CLI derives the filename from the URL.
    • If no path is provided, it uses the default geofeed download directory.