Overview
TheRdapClient is the primary interface for executing RDAP queries. It handles HTTP requests, server discovery via bootstrap, response parsing, and automatic registrar referral following for multi-layer RDAP queries.
Constructor
new()
Create a new RDAP client with default configuration.Returns a configured RDAP client or an error if initialization fails.
- 30 second timeout
- User agent:
rdap-rust/{version} - Registrar referral following enabled
- Bootstrap client initialized
Configuration Methods
with_timeout()
Set a custom timeout duration for HTTP requests.The timeout duration for HTTP requests
Returns self for method chaining
with_follow_referral()
Enable or disable automatic registrar referral following for domain queries.Whether to follow registrar referral links (default: true)
Returns self for method chaining
Query Methods
query()
Execute an RDAP query and return a single result object. If registrar data is available, it returns the registrar object; otherwise, it returns the registry object.The RDAP request to execute
Returns the RDAP response object (preferring registrar data if available)
query_with_referral()
Execute an RDAP query with full registrar referral support. Returns both registry and registrar data if available.The RDAP request to execute
Returns a query result containing registry data, optional registrar data, and server URLs
Primary result from the registry RDAP server
URL of the registry RDAP server used
Optional result from the registrar RDAP server (for domain queries)
URL of the registrar RDAP server used (if any)
fetch_rdap()
Fetch RDAP data directly from a specific URL without bootstrap discovery.The full RDAP server URL to query
Returns the parsed RDAP response object
Special Features
IPv6 CIDR Fallback
The client automatically retries IPv6 host queries with CIDR notation if the initial query returns a 400 error. This handles RDAP servers that don’t support host-level IPv6 queries. Retry sequence for failed IPv6 queries:- Original host query (e.g.,
2001:db8::1) - /64 CIDR query (e.g.,
2001:db8::/64) - /48 CIDR query (e.g.,
2001:db8::/48) - /32 CIDR query (e.g.,
2001:db8::/32)
Registrar Referral Following
For domain queries, the client automatically:- Queries the registry RDAP server
- Checks for registrar referral links in the response
- Follows the referral to fetch detailed registrar data
- Skips referrals that point to the same server
- Falls back to registry-only data if registrar query fails
with_follow_referral().
Error Handling
The client returnsResult<T> types with the following error variants:
- NotFound: HTTP 404 - Object not found
- ServerError: HTTP error with code, title, and optional description
- Bootstrap: Bootstrap service errors
- NoWorkingServers: All server attempts failed
- Json: JSON parsing errors
- Http: Network/HTTP errors
- Other: General errors
