9 releases

0.0.16 Mar 15, 2024
0.0.15 Dec 18, 2023
0.0.14 Nov 26, 2023
0.0.13 Aug 7, 2023
0.0.9 Jun 24, 2023

#609 in Network programming

Download history 39/week @ 2023-12-28 13/week @ 2024-02-22 12/week @ 2024-02-29 9/week @ 2024-03-07 168/week @ 2024-03-14 11/week @ 2024-03-21 28/week @ 2024-03-28 17/week @ 2024-04-04

60 downloads per month
Used in 3 crates

MIT/Apache

280KB
7K SLoC

ICANN RDAP Common

This is a common component 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.

Installation

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

This library can be compiled for WASM targets.

Usage

Create some RDAP objects:

// create an entity
use icann_rdap_common::response::entity::Entity;
let holder = Entity::basic().handle("foo-BAR").build();

// create an RDAP domain
use icann_rdap_common::response::domain::Domain;
let domain = Domain::basic().ldh_name("example.com").entity(holder.clone()).build();

// create an IP network
use icann_rdap_common::response::network::Network;
let net = Network::basic().cidr("10.0.0.0/16").entity(holder.clone()).build().unwrap();

// create a nameserver
use icann_rdap_common::response::nameserver::Nameserver;
let ns = Nameserver::basic().ldh_name("ns1.example.com").entity(holder.clone()).build().unwrap();

// create an autnum
use icann_rdap_common::response::autnum::Autnum;
let autnum = Autnum::basic().autnum_range(700..700).entity(holder).build();

Parse RDAP JSON:

use icann_rdap_common::response::RdapResponse;

let json = r#"
  {
    "objectClassName": "ip network",
    "links": [
      {
        "value": "http://localhost:3000/rdap/ip/10.0.0.0/16",
        "rel": "self",
        "href": "http://localhost:3000/rdap/ip/10.0.0.0/16",
        "type": "application/rdap+json"
      }
    ],
    "events": [
      {
        "eventAction": "registration",
        "eventDate": "2023-06-16T22:56:49.594173356+00:00"
      },
      {
        "eventAction": "last changed",
        "eventDate": "2023-06-16T22:56:49.594189140+00:00"
      }
    ],
    "startAddress": "10.0.0.0",
    "endAddress": "10.0.255.255",
    "ipVersion": "v4"
  }
"#;

let rdap: RdapResponse = serde_json::from_str(json).unwrap();
assert!(matches!(rdap, RdapResponse::Network(_)));

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

~6–22MB
~361K SLoC