Class: MonoVM::Whois::Registry::Sources::IanaBootstrap
- Defined in:
- lib/monovm/whois/registry/sources/iana_bootstrap.rb
Overview
The IANA RDAP bootstrap registry (RFC 7484).
IANA publishes the authoritative TLD -> RDAP base URL map at https://data.iana.org/rdap/dns.json. A snapshot ships with the gem, which is why this library can answer for far more TLDs than a hand-maintained port 43 list covers, and why those answers are structured JSON instead of registry prose.
The file looks like:
{
"version": "1.0",
"publication": "2026-07-23T02:00:03Z",
"services": [
[ ["com", "net"], ["https://rdap.verisign.com/com/v1/"] ]
]
}
Reading is deliberately offline. Fetching at load time would put a network
round trip in front of every process boot and make the library's own
startup depend on IANA being reachable; rake data:refresh_rdap updates
the snapshot instead.
Constant Summary collapse
- BOOTSTRAP_URL =
"https://data.iana.org/rdap/dns.json"- DOMAIN_PATH =
RDAP domain lookups live under
{base}/domain/{name}(RFC 7482 §3.1.3). "domain/"
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path: Paths::RDAP_BOOTSTRAP, optional: true) ⇒ IanaBootstrap
constructor
A new instance of IanaBootstrap.
- #load ⇒ Hash{String => Definition}
- #name ⇒ Object
- #optional? ⇒ Boolean
-
#published_at ⇒ String?
The snapshot's publication timestamp.
Constructor Details
#initialize(path: Paths::RDAP_BOOTSTRAP, optional: true) ⇒ IanaBootstrap
Returns a new instance of IanaBootstrap.
41 42 43 44 45 |
# File 'lib/monovm/whois/registry/sources/iana_bootstrap.rb', line 41 def initialize(path: Paths::RDAP_BOOTSTRAP, optional: true) @path = path @optional = optional super() end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
39 40 41 |
# File 'lib/monovm/whois/registry/sources/iana_bootstrap.rb', line 39 def path @path end |
Instance Method Details
#load ⇒ Hash{String => Definition}
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/monovm/whois/registry/sources/iana_bootstrap.rb', line 61 def load services = document&.fetch("services", nil) return {} unless services.is_a?(Array) services.each_with_object({}) do |service, definitions| endpoint = endpoint_for(service) next if endpoint.nil? tlds_in(service).each do |tld| definitions[tld] ||= Definition.new(tld: tld, rdap_endpoint: endpoint, sources: [name]) end end end |
#name ⇒ Object
47 48 49 |
# File 'lib/monovm/whois/registry/sources/iana_bootstrap.rb', line 47 def name "iana-rdap" end |
#optional? ⇒ Boolean
51 52 53 |
# File 'lib/monovm/whois/registry/sources/iana_bootstrap.rb', line 51 def optional? @optional end |
#published_at ⇒ String?
Returns the snapshot's publication timestamp.
56 57 58 |
# File 'lib/monovm/whois/registry/sources/iana_bootstrap.rb', line 56 def published_at document&.fetch("publication", nil) end |