Skip to main content

rdapify/
lib.rs

1//! # rdapify
2//!
3//! A unified, secure, high-performance RDAP client library for Rust.
4//!
5//! This crate is the public API facade that re-exports workspace crates
6//! with configurable feature flags for minimal binary sizes.
7//!
8//! ## Feature flags
9//!
10//! | Feature        | Default | Description                                      |
11//! |----------------|---------|--------------------------------------------------|
12//! | `memory-cache` | ✓       | In-memory DashMap response cache                 |
13//! | `stream`       | ✓       | Async streaming query API (`tokio-stream`)       |
14//! | `batch`        |         | Batch query execution with concurrency control   |
15//! | `rate-limit`   |         | Per-registry and global rate limiting            |
16//! | `sqlite`       |         | SQLite persistence backend                       |
17//! | `postgres`     |         | PostgreSQL persistence backend                   |
18//! | `mysql`        |         | MySQL / MariaDB persistence backend              |
19//! | `service`      |         | HTTP API service runtime (Axum-based)            |
20//! | `full`         |         | Enables: `memory-cache`, `stream`, `batch`, `rate-limit` |
21//!
22//! ## Quick start
23//!
24//! ```rust,no_run
25//! use rdapify::RdapClient;
26//!
27//! #[tokio::main]
28//! async fn main() -> rdapify::error::Result<()> {
29//!     let client = RdapClient::new()?;
30//!
31//!     let domain = client.domain("example.com").await?;
32//!     println!("Registrar: {:?}", domain.registrar);
33//!
34//!     let ip = client.ip("8.8.8.8").await?;
35//!     println!("Country: {:?}", ip.country);
36//!
37//!     Ok(())
38//! }
39//! ```
40
41#![forbid(unsafe_code)]
42
43// ── Core re-exports (always available) ───────────────────────────────────────
44
45pub use rdap_types::error::{RdapError, Result};
46pub use rdapify_client::{ClientConfig, RdapClient};
47
48pub use rdap_types::{
49    AsnResponse, AvailabilityResult, DomainResponse, EntityResponse, IpResponse, IpVersion,
50    NameserverIpAddresses, NameserverResponse, RdapEntity, RdapEvent, RdapLink, RdapRemark,
51    RdapRole, RdapStatus, RegistrarSummary, ResponseMeta,
52};
53
54pub use rdap_core::{FetcherConfig, Normalizer};
55pub use rdap_security::{SsrfConfig, SsrfGuard};
56
57// ── Feature-gated flat re-exports ────────────────────────────────────────────
58
59#[cfg(feature = "memory-cache")]
60pub use rdap_cache::{CacheConfig, MemoryCache};
61
62#[cfg(feature = "stream")]
63pub use rdapify_client::{AsnEvent, DomainEvent, IpEvent, NameserverEvent, StreamConfig};
64
65// ── Always-available modules ──────────────────────────────────────────────────
66
67pub mod error {
68    pub use rdap_types::error::*;
69}
70
71pub mod bootstrap {
72    pub use rdap_bootstrap::Bootstrap;
73}
74
75pub mod http {
76    pub use rdap_core::{Fetcher, FetcherConfig, Normalizer};
77}
78
79pub mod security {
80    pub use rdap_security::{SsrfConfig, SsrfGuard};
81}
82
83pub mod types {
84    pub use rdap_types::*;
85}
86
87// ── Feature-gated modules ─────────────────────────────────────────────────────
88
89#[cfg(feature = "memory-cache")]
90pub mod cache {
91    //! In-memory response cache.
92    pub use rdap_cache::{CacheConfig, MemoryCache};
93}
94
95#[cfg(feature = "stream")]
96pub mod stream {
97    //! Async streaming query events.
98    pub use rdapify_client::{AsnEvent, DomainEvent, IpEvent, NameserverEvent, StreamConfig};
99}
100
101#[cfg(feature = "batch")]
102pub mod batch {
103    //! Batch query execution with concurrency control.
104    pub use rdap_batch::BatchExecutor;
105}
106
107#[cfg(feature = "rate-limit")]
108pub mod rate_limit {
109    //! Per-registry and global rate limiting.
110    pub use rdap_rate_limit::{RateLimitConfig, RateLimiter};
111}
112
113/// SQLite persistence backend (skeleton — full impl pending).
114#[cfg(feature = "sqlite")]
115pub mod sqlite {}
116
117/// PostgreSQL persistence backend (skeleton — full impl pending).
118#[cfg(feature = "postgres")]
119pub mod postgres {}
120
121/// MySQL / MariaDB persistence backend (skeleton — full impl pending).
122#[cfg(feature = "mysql")]
123pub mod mysql {}
124
125/// HTTP API service runtime (skeleton — full impl pending).
126#[cfg(feature = "service")]
127pub mod service {}