Overview
The bootstrap system discovers authoritative RDAP servers for queries using IANA bootstrap registries. It implements RFC 7484 (Finding the Authoritative RDAP Service) with support for TLD overrides.BootstrapClient
Client for RDAP service discovery.BootstrapClient orchestrates the discovery of RDAP servers by:
- Checking TLD overrides first (for domains)
- Fetching IANA bootstrap registries
- Matching queries against registry entries
- Returning authoritative RDAP server URLs
new()
Creates a new bootstrap client.- HTTP client for fetching bootstrap registries
- Loaded configuration (bootstrap URLs, cache settings)
- TLD overrides for domain queries
BootstrapClient instance
lookup()
Looks up RDAP servers for a request.RDAP request containing query type and query string
Lookup Strategy by Query Type
TLD Queries (QueryType::Tld)
- Always directed to IANA RDAP server:
https://rdap.iana.org/ - Used for querying TLD metadata (e.g.,
rdap google)
QueryType::Domain)
- Check TLD overrides from
tlds.jsonfirst - If override found, return that server URL
- Otherwise, fetch IANA DNS bootstrap registry
- Match domain against bootstrap entries
QueryType::Ip)
- Determine IPv4 or IPv6 based on query format (
:indicates IPv6) - Fetch appropriate bootstrap registry (
ipv4.jsonoripv6.json) - Normalize IP address (handles shorthand like
1.1→1.0.0.1) - Match IP against CIDR ranges in registry
QueryType::Autnum)
- Fetch ASN bootstrap registry
- Strip “AS” prefix if present (case-insensitive)
- Match AS number against ranges in registry
QueryType::Entity)
- Returns error: requires explicit server via
-s/--serverflag - No global bootstrap for entity handles
TLD Override Logic
TLD overrides allow bypassing IANA bootstrap for specific domains. This is essential for:- ccTLDs not in IANA bootstrap
- TLDs with incorrect bootstrap data
- Custom RDAP server configurations
Override Priority
For domain queries, TLD overrides are checked before IANA bootstrap:Matching Algorithm
When looking up a domain likeexample.com.af, the system tries matches from most specific to least specific:
example.com.af(full domain)com.af(second-level domain)af(top-level domain)
Example Overrides
example.io → matches "io" → uses Identity Digital RDAP server
Query example.com.af → matches "com.af" → uses COCCA Registry RDAP server
extract_tld()
Extracts the TLD from a domain name.Domain name (e.g., “example.com”)
- Removes trailing dots
- Converts to lowercase
- Splits on
.and returns the last component
Bootstrap Registry Format
IANA bootstrap registries use this JSON structure:- Array of entries (TLDs, IP ranges, or ASN ranges)
- Array of RDAP server URLs
DNS Bootstrap
Maps TLDs to RDAP servers:IPv4/IPv6 Bootstrap
Maps CIDR ranges to RDAP servers:ASN Bootstrap
Maps AS number ranges to RDAP servers:Matching Algorithms
Domain Matching
IP Matching
- Normalize IP (handles shorthand:
1.1→1.0.0.1) - Extract IP from CIDR if present (
8.8.8.0/24→8.8.8.0) - Parse to
IpAddr - Check if IP is contained in any CIDR range using
ipnetcrate
ASN Matching
- Strip “AS” prefix if present (case-insensitive)
- Parse to
u32 - Check if ASN falls within any range:
- Single ASN:
"1000"→ exact match - Range:
"1000-2000"→asn >= 1000 && asn <= 2000
- Single ASN:
Error Handling
The bootstrap client returns errors for:- Invalid queries: Malformed IP addresses or ASNs
- Network failures: Unable to fetch bootstrap registries
- HTTP errors: Non-success status codes from IANA
- No match found: Query doesn’t match any bootstrap entry
- Unsupported query types: Entity queries without explicit server
Example Usage
Related
- Configuration API - TLD overrides and bootstrap URLs
- Cache API - Bootstrap file caching
