rdapify/lib.rs
1//! # rdapify
2//!
3//! A unified, secure, high-performance RDAP client library for Rust.
4//!
5//! ## Features
6//!
7//! - **5 query types**: domain, IP, ASN, nameserver, entity
8//! - **SSRF protection** built-in — blocks private / loopback / link-local addresses
9//! - **IANA Bootstrap** (RFC 9224) — automatically discovers the correct RDAP server
10//! - **In-memory cache** — reduces redundant network calls
11//! - **Exponential back-off retries** for transient failures
12//! - **Normalised responses** — consistent structure regardless of the RDAP server
13//!
14//! ## Quick start
15//!
16//! ```rust,no_run
17//! use rdapify::RdapClient;
18//!
19//! #[tokio::main]
20//! async fn main() -> rdapify::error::Result<()> {
21//! let client = RdapClient::new()?;
22//!
23//! let domain = client.domain("example.com").await?;
24//! println!("Registrar: {:?}", domain.registrar);
25//! println!("Expires: {:?}", domain.expiration_date());
26//!
27//! let ip = client.ip("8.8.8.8").await?;
28//! println!("Country: {:?}", ip.country);
29//!
30//! let asn = client.asn("AS15169").await?;
31//! println!("AS Name: {:?}", asn.name);
32//!
33//! let ns = client.nameserver("ns1.google.com").await?;
34//! println!("IPv4: {:?}", ns.ip_addresses.v4);
35//!
36//! let entity = client.entity("ARIN-HN-1", "https://rdap.arin.net/registry").await?;
37//! println!("Handle: {:?}", entity.handle);
38//!
39//! Ok(())
40//! }
41//! ```
42
43#![forbid(unsafe_code)]
44#![cfg_attr(docsrs, warn(missing_docs))]
45#![cfg_attr(docsrs, feature(doc_cfg))]
46
47// ── Internal modules ──────────────────────────────────────────────────────────
48
49pub mod bootstrap;
50pub mod cache;
51pub mod error;
52pub mod http;
53pub mod security;
54pub mod stream;
55pub mod types;
56
57mod client;
58
59// ── Public re-exports ─────────────────────────────────────────────────────────
60
61pub use client::{ClientConfig, RdapClient};
62pub use error::{RdapError, Result};
63
64pub use types::{
65 AsnResponse, AvailabilityResult, DomainResponse, EntityResponse, IpResponse, IpVersion,
66 NameserverIpAddresses, NameserverResponse, RdapEntity, RdapEvent, RdapLink, RdapRemark,
67 RdapRole, RdapStatus, RegistrarSummary, ResponseMeta,
68};
69
70pub use cache::{CacheConfig, MemoryCache};
71pub use http::{FetcherConfig, Normalizer};
72pub use security::{SsrfConfig, SsrfGuard};
73pub use stream::{AsnEvent, DomainEvent, IpEvent, NameserverEvent, StreamConfig};