rdap 0.1.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/data/ipv4.json ADDED
@@ -0,0 +1,265 @@
1
+ {
2
+ "description": "RDAP bootstrap file for IPv4 address allocations",
3
+ "publication": "2019-06-07T19:00:02Z",
4
+ "services": [
5
+ [
6
+ [
7
+ "41.0.0.0/8",
8
+ "102.0.0.0/8",
9
+ "105.0.0.0/8",
10
+ "154.0.0.0/8",
11
+ "196.0.0.0/8",
12
+ "197.0.0.0/8"
13
+ ],
14
+ [
15
+ "https://rdap.afrinic.net/rdap/",
16
+ "http://rdap.afrinic.net/rdap/"
17
+ ]
18
+ ],
19
+ [
20
+ [
21
+ "1.0.0.0/8",
22
+ "14.0.0.0/8",
23
+ "27.0.0.0/8",
24
+ "36.0.0.0/8",
25
+ "39.0.0.0/8",
26
+ "42.0.0.0/8",
27
+ "43.0.0.0/8",
28
+ "49.0.0.0/8",
29
+ "58.0.0.0/8",
30
+ "59.0.0.0/8",
31
+ "60.0.0.0/8",
32
+ "61.0.0.0/8",
33
+ "101.0.0.0/8",
34
+ "103.0.0.0/8",
35
+ "106.0.0.0/8",
36
+ "110.0.0.0/8",
37
+ "111.0.0.0/8",
38
+ "112.0.0.0/8",
39
+ "113.0.0.0/8",
40
+ "114.0.0.0/8",
41
+ "115.0.0.0/8",
42
+ "116.0.0.0/8",
43
+ "117.0.0.0/8",
44
+ "118.0.0.0/8",
45
+ "119.0.0.0/8",
46
+ "120.0.0.0/8",
47
+ "121.0.0.0/8",
48
+ "122.0.0.0/8",
49
+ "123.0.0.0/8",
50
+ "124.0.0.0/8",
51
+ "125.0.0.0/8",
52
+ "126.0.0.0/8",
53
+ "133.0.0.0/8",
54
+ "150.0.0.0/8",
55
+ "153.0.0.0/8",
56
+ "163.0.0.0/8",
57
+ "171.0.0.0/8",
58
+ "175.0.0.0/8",
59
+ "180.0.0.0/8",
60
+ "182.0.0.0/8",
61
+ "183.0.0.0/8",
62
+ "202.0.0.0/8",
63
+ "203.0.0.0/8",
64
+ "210.0.0.0/8",
65
+ "211.0.0.0/8",
66
+ "218.0.0.0/8",
67
+ "219.0.0.0/8",
68
+ "220.0.0.0/8",
69
+ "221.0.0.0/8",
70
+ "222.0.0.0/8",
71
+ "223.0.0.0/8"
72
+ ],
73
+ [
74
+ "https://rdap.apnic.net/"
75
+ ]
76
+ ],
77
+ [
78
+ [
79
+ "3.0.0.0/8",
80
+ "4.0.0.0/8",
81
+ "6.0.0.0/8",
82
+ "7.0.0.0/8",
83
+ "8.0.0.0/8",
84
+ "9.0.0.0/8",
85
+ "11.0.0.0/8",
86
+ "12.0.0.0/8",
87
+ "13.0.0.0/8",
88
+ "15.0.0.0/8",
89
+ "16.0.0.0/8",
90
+ "17.0.0.0/8",
91
+ "18.0.0.0/8",
92
+ "19.0.0.0/8",
93
+ "20.0.0.0/8",
94
+ "21.0.0.0/8",
95
+ "22.0.0.0/8",
96
+ "23.0.0.0/8",
97
+ "24.0.0.0/8",
98
+ "26.0.0.0/8",
99
+ "28.0.0.0/8",
100
+ "29.0.0.0/8",
101
+ "30.0.0.0/8",
102
+ "32.0.0.0/8",
103
+ "33.0.0.0/8",
104
+ "34.0.0.0/8",
105
+ "35.0.0.0/8",
106
+ "38.0.0.0/8",
107
+ "40.0.0.0/8",
108
+ "44.0.0.0/8",
109
+ "45.0.0.0/8",
110
+ "47.0.0.0/8",
111
+ "48.0.0.0/8",
112
+ "50.0.0.0/8",
113
+ "52.0.0.0/8",
114
+ "54.0.0.0/8",
115
+ "55.0.0.0/8",
116
+ "56.0.0.0/8",
117
+ "63.0.0.0/8",
118
+ "64.0.0.0/8",
119
+ "65.0.0.0/8",
120
+ "66.0.0.0/8",
121
+ "67.0.0.0/8",
122
+ "68.0.0.0/8",
123
+ "69.0.0.0/8",
124
+ "70.0.0.0/8",
125
+ "71.0.0.0/8",
126
+ "72.0.0.0/8",
127
+ "73.0.0.0/8",
128
+ "74.0.0.0/8",
129
+ "75.0.0.0/8",
130
+ "76.0.0.0/8",
131
+ "96.0.0.0/8",
132
+ "97.0.0.0/8",
133
+ "98.0.0.0/8",
134
+ "99.0.0.0/8",
135
+ "100.0.0.0/8",
136
+ "104.0.0.0/8",
137
+ "107.0.0.0/8",
138
+ "108.0.0.0/8",
139
+ "128.0.0.0/8",
140
+ "129.0.0.0/8",
141
+ "130.0.0.0/8",
142
+ "131.0.0.0/8",
143
+ "132.0.0.0/8",
144
+ "134.0.0.0/8",
145
+ "135.0.0.0/8",
146
+ "136.0.0.0/8",
147
+ "137.0.0.0/8",
148
+ "138.0.0.0/8",
149
+ "139.0.0.0/8",
150
+ "140.0.0.0/8",
151
+ "142.0.0.0/8",
152
+ "143.0.0.0/8",
153
+ "144.0.0.0/8",
154
+ "146.0.0.0/8",
155
+ "147.0.0.0/8",
156
+ "148.0.0.0/8",
157
+ "149.0.0.0/8",
158
+ "152.0.0.0/8",
159
+ "155.0.0.0/8",
160
+ "156.0.0.0/8",
161
+ "157.0.0.0/8",
162
+ "158.0.0.0/8",
163
+ "159.0.0.0/8",
164
+ "160.0.0.0/8",
165
+ "161.0.0.0/8",
166
+ "162.0.0.0/8",
167
+ "164.0.0.0/8",
168
+ "165.0.0.0/8",
169
+ "166.0.0.0/8",
170
+ "167.0.0.0/8",
171
+ "168.0.0.0/8",
172
+ "169.0.0.0/8",
173
+ "170.0.0.0/8",
174
+ "172.0.0.0/8",
175
+ "173.0.0.0/8",
176
+ "174.0.0.0/8",
177
+ "184.0.0.0/8",
178
+ "192.0.0.0/8",
179
+ "198.0.0.0/8",
180
+ "199.0.0.0/8",
181
+ "204.0.0.0/8",
182
+ "205.0.0.0/8",
183
+ "206.0.0.0/8",
184
+ "207.0.0.0/8",
185
+ "208.0.0.0/8",
186
+ "209.0.0.0/8",
187
+ "214.0.0.0/8",
188
+ "215.0.0.0/8",
189
+ "216.0.0.0/8"
190
+ ],
191
+ [
192
+ "https://rdap.arin.net/registry/",
193
+ "http://rdap.arin.net/registry/"
194
+ ]
195
+ ],
196
+ [
197
+ [
198
+ "2.0.0.0/8",
199
+ "5.0.0.0/8",
200
+ "25.0.0.0/8",
201
+ "31.0.0.0/8",
202
+ "37.0.0.0/8",
203
+ "46.0.0.0/8",
204
+ "51.0.0.0/8",
205
+ "53.0.0.0/8",
206
+ "57.0.0.0/8",
207
+ "62.0.0.0/8",
208
+ "77.0.0.0/8",
209
+ "78.0.0.0/8",
210
+ "79.0.0.0/8",
211
+ "80.0.0.0/8",
212
+ "81.0.0.0/8",
213
+ "82.0.0.0/8",
214
+ "83.0.0.0/8",
215
+ "84.0.0.0/8",
216
+ "85.0.0.0/8",
217
+ "86.0.0.0/8",
218
+ "87.0.0.0/8",
219
+ "88.0.0.0/8",
220
+ "89.0.0.0/8",
221
+ "90.0.0.0/8",
222
+ "91.0.0.0/8",
223
+ "92.0.0.0/8",
224
+ "93.0.0.0/8",
225
+ "94.0.0.0/8",
226
+ "95.0.0.0/8",
227
+ "109.0.0.0/8",
228
+ "141.0.0.0/8",
229
+ "145.0.0.0/8",
230
+ "151.0.0.0/8",
231
+ "176.0.0.0/8",
232
+ "178.0.0.0/8",
233
+ "185.0.0.0/8",
234
+ "188.0.0.0/8",
235
+ "193.0.0.0/8",
236
+ "194.0.0.0/8",
237
+ "195.0.0.0/8",
238
+ "212.0.0.0/8",
239
+ "213.0.0.0/8",
240
+ "217.0.0.0/8"
241
+ ],
242
+ [
243
+ "https://rdap.db.ripe.net/"
244
+ ]
245
+ ],
246
+ [
247
+ [
248
+ "177.0.0.0/8",
249
+ "179.0.0.0/8",
250
+ "181.0.0.0/8",
251
+ "186.0.0.0/8",
252
+ "187.0.0.0/8",
253
+ "189.0.0.0/8",
254
+ "190.0.0.0/8",
255
+ "191.0.0.0/8",
256
+ "200.0.0.0/8",
257
+ "201.0.0.0/8"
258
+ ],
259
+ [
260
+ "https://rdap.lacnic.net/rdap/"
261
+ ]
262
+ ]
263
+ ],
264
+ "version": "1.0"
265
+ }
data/data/ipv6.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "description": "RDAP bootstrap file for IPv6 address allocations",
3
+ "publication": "2024-11-01T22:00:01Z",
4
+ "services": [
5
+ [
6
+ [
7
+ "2001:4200::/23",
8
+ "2c00::/12"
9
+ ],
10
+ [
11
+ "https://rdap.afrinic.net/rdap/",
12
+ "http://rdap.afrinic.net/rdap/"
13
+ ]
14
+ ],
15
+ [
16
+ [
17
+ "2001:200::/23",
18
+ "2001:4400::/23",
19
+ "2001:8000::/19",
20
+ "2001:a000::/20",
21
+ "2001:b000::/20",
22
+ "2001:c00::/23",
23
+ "2001:e00::/23",
24
+ "2400::/12",
25
+ "2410::/12"
26
+ ],
27
+ [
28
+ "https://rdap.apnic.net/"
29
+ ]
30
+ ],
31
+ [
32
+ [
33
+ "2001:1800::/23",
34
+ "2001:400::/23",
35
+ "2001:4800::/23",
36
+ "2600::/12",
37
+ "2610::/23",
38
+ "2620::/23",
39
+ "2630::/12"
40
+ ],
41
+ [
42
+ "https://rdap.arin.net/registry/",
43
+ "http://rdap.arin.net/registry/"
44
+ ]
45
+ ],
46
+ [
47
+ [
48
+ "2001:1400::/22",
49
+ "2001:1a00::/23",
50
+ "2001:1c00::/22",
51
+ "2001:2000::/19",
52
+ "2001:4000::/23",
53
+ "2001:4600::/23",
54
+ "2001:4a00::/23",
55
+ "2001:4c00::/23",
56
+ "2001:5000::/20",
57
+ "2001:600::/23",
58
+ "2001:800::/22",
59
+ "2003::/18",
60
+ "2a00::/12",
61
+ "2a10::/12"
62
+ ],
63
+ [
64
+ "https://rdap.db.ripe.net/"
65
+ ]
66
+ ],
67
+ [
68
+ [
69
+ "2001:1200::/23",
70
+ "2800::/12"
71
+ ],
72
+ [
73
+ "https://rdap.lacnic.net/rdap/"
74
+ ]
75
+ ]
76
+ ],
77
+ "version": "1.0"
78
+ }
data/lib/rdap.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  require 'json'
2
2
  require 'net/http'
3
+ require 'ipaddr'
3
4
 
4
5
  module RDAP
5
- VERSION = "0.1.5"
6
+ VERSION = "1.0.0"
6
7
  BOOTSTRAP = "https://rdap.org/"
7
8
  TYPES = [:domain, :ip, :autnum].freeze
8
9
  HEADERS = {
@@ -19,26 +20,65 @@ module RDAP
19
20
  class NotFound < Error; end
20
21
  class TooManyRequests < Error; end
21
22
 
22
- def self.domain name, **opts
23
- query name, type: :domain, **opts
23
+ def self.domain name, server: nil, **opts
24
+ tld = name.to_s.chomp('.').split('.').last
25
+ server ||= dns_index[tld.downcase] if tld
26
+ query name, type: :domain, server: server, **opts
24
27
  end
25
28
 
26
- def self.ip name, **opts
27
- query name, type: :ip, **opts
29
+ def self.ip name, server: nil, **opts
30
+ ip = IPAddr.new(name.to_s)
31
+ server ||= ip_index(ip.ipv6? ? 'ipv6' : 'ipv4').find { |net, _| net.include?(ip) }&.last
32
+ query name, type: :ip, server: server, **opts
28
33
  end
29
34
 
30
- def self.as name, **opts
31
- query name, type: :autnum, **opts
35
+ def self.as name, server: nil, **opts
36
+ asn = name.to_i if name.is_a?(Integer) || name.to_s =~ /\A\d+\z/
37
+ raise ArgumentError.new("RDAP: Invalid AS number: #{name.inspect}") unless asn
38
+ server ||= asn_index.find { |range, _| range.cover?(asn) }&.last
39
+ query name, type: :autnum, server: server, **opts
32
40
  end
33
41
 
34
- def self.query name, type:, timeout: 5, server: BOOTSTRAP, headers: {}
42
+ def self.query name, type:, timeout: 5, server: nil, headers: {}
35
43
  TYPES.include?(type) or raise ArgumentError.new("RDAP: Invalid query type: #{type}, supported types: #{TYPES}")
44
+ # .domain/.ip/.as resolve the authoritative server from the bundled IANA
45
+ # files; fall back to the public bootstrap server for anything not covered.
46
+ server ||= BOOTSTRAP
36
47
  uri = URI("#{server.chomp('/')}/#{type}/#{name}")
37
48
  get_follow_redirects(uri, timeout: timeout, headers: headers)
38
49
  end
39
50
 
40
51
  private
41
52
 
53
+ # TLD => RDAP server, built once for O(1) domain lookups. IANA lists the
54
+ # preferred (https) endpoint first, so urls.first is the server to use.
55
+ def self.dns_index
56
+ @dns_index ||= bootstrap('dns').each_with_object({}) do |(labels, urls), index|
57
+ labels.each { |label| index[label.downcase] = urls.first }
58
+ end
59
+ end
60
+
61
+ # [network, RDAP server] pairs for a registry, built once so the CIDRs are
62
+ # parsed into IPAddr objects a single time rather than on every lookup.
63
+ def self.ip_index registry
64
+ (@ip_index ||= {})[registry] ||= bootstrap(registry).flat_map do |cidrs, urls|
65
+ cidrs.map { |cidr| [IPAddr.new(cidr), urls.first] }
66
+ end
67
+ end
68
+
69
+ # [AS range, RDAP server] pairs, built once so the ranges are parsed a single
70
+ # time rather than on every lookup.
71
+ def self.asn_index
72
+ @asn_index ||= bootstrap('asn').flat_map do |ranges, urls|
73
+ ranges.map { |range| low, high = range.split('-'); [(low.to_i..(high || low).to_i), urls.first] }
74
+ end
75
+ end
76
+
77
+ # Service entries from a bundled IANA bootstrap file (https://data.iana.org/rdap/).
78
+ def self.bootstrap registry
79
+ JSON.parse(File.read(File.expand_path("../data/#{registry}.json", __dir__)))["services"]
80
+ end
81
+
42
82
  def self.get_follow_redirects uri, timeout: 5, headers: {}, redirection_limit: 5
43
83
  raise ServerError.new("Too many redirections (> #{redirection_limit}) at #{uri}") if redirection_limit == 0
44
84
 
metadata CHANGED
@@ -1,35 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Rey-Jarthon
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-12-29 00:00:00.000000000 Z
10
+ date: 2026-06-27 00:00:00.000000000 Z
12
11
  dependencies: []
13
- description:
14
12
  email:
15
13
  - jobs@adrienjarthon.com
16
14
  executables: []
17
15
  extensions: []
18
16
  extra_rdoc_files: []
19
17
  files:
20
- - ".gitignore"
21
- - ".travis.yml"
22
- - Gemfile
23
- - Gemfile.lock
24
- - README.md
25
- - Rakefile
26
- - bin/console
18
+ - data/asn.json
19
+ - data/dns.json
20
+ - data/ipv4.json
21
+ - data/ipv6.json
27
22
  - lib/rdap.rb
28
- - rdap.gemspec
29
23
  homepage: https://github.com/jarthod/rdap
30
24
  licenses: []
31
25
  metadata: {}
32
- post_install_message:
33
26
  rdoc_options: []
34
27
  require_paths:
35
28
  - lib
@@ -37,15 +30,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
37
30
  requirements:
38
31
  - - ">="
39
32
  - !ruby/object:Gem::Version
40
- version: 2.3.0
33
+ version: 3.2.0
41
34
  required_rubygems_version: !ruby/object:Gem::Requirement
42
35
  requirements:
43
36
  - - ">="
44
37
  - !ruby/object:Gem::Version
45
38
  version: '0'
46
39
  requirements: []
47
- rubygems_version: 3.3.7
48
- signing_key:
40
+ rubygems_version: 3.6.2
49
41
  specification_version: 4
50
42
  summary: A minimal Ruby client to query RDAP APIs though a bootstrap server
51
43
  test_files: []
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- # Ubuntu 18.04
5
- dist: bionic
6
- # https://docs.travis-ci.com/user/reference/bionic/#ruby-support
7
- rvm:
8
- - 2.6.5
9
- - 2.7.0
10
- - 3.0.3
11
- before_install: gem install bundler -v 2.1.4
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in rdap.gemspec
4
- gemspec
5
-
6
- gem "rake", ">= 12.0"
7
- gem "rspec", "~> 3.0"
8
- gem "vcr", "~> 6.0"
9
- gem "webmock"
data/Gemfile.lock DELETED
@@ -1,48 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rdap (0.1.4)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- addressable (2.8.1)
10
- public_suffix (>= 2.0.2, < 6.0)
11
- crack (0.4.5)
12
- rexml
13
- diff-lcs (1.5.0)
14
- hashdiff (1.0.1)
15
- public_suffix (5.0.1)
16
- rake (13.0.6)
17
- rexml (3.2.5)
18
- rspec (3.12.0)
19
- rspec-core (~> 3.12.0)
20
- rspec-expectations (~> 3.12.0)
21
- rspec-mocks (~> 3.12.0)
22
- rspec-core (3.12.0)
23
- rspec-support (~> 3.12.0)
24
- rspec-expectations (3.12.1)
25
- diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.12.0)
27
- rspec-mocks (3.12.1)
28
- diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.12.0)
30
- rspec-support (3.12.0)
31
- vcr (6.1.0)
32
- webmock (3.18.1)
33
- addressable (>= 2.8.0)
34
- crack (>= 0.3.2)
35
- hashdiff (>= 0.4.0, < 2.0.0)
36
-
37
- PLATFORMS
38
- ruby
39
-
40
- DEPENDENCIES
41
- rake (>= 12.0)
42
- rdap!
43
- rspec (~> 3.0)
44
- vcr (~> 6.0)
45
- webmock
46
-
47
- BUNDLED WITH
48
- 2.1.4
data/README.md DELETED
@@ -1,110 +0,0 @@
1
- # RDAP [![Build Status](https://app.travis-ci.com/jarthod/rdap.svg?branch=master)](https://app.travis-ci.com/github/jarthod/rdap)
2
-
3
- A minimal Ruby client to query RDAP APIs though a bootstrap server.
4
- No dependencies, no caching or bootstrap file (the query is routed through a bootstrap server first).
5
-
6
- [RDAP](https://en.wikipedia.org/wiki/Registration_Data_Access_Protocol) is a new protocol destined to replace WHOIS to query informations about domains, IPs, ASNs, etc.
7
- Not all TLDs support RDAP at the moment, but the deployment is going well: https://deployment.rdap.org
8
-
9
- This library is optimal for low volume queries (the [bootstrap server we used here](https://about.rdap.org/) enforces [some throttling](https://about.rdap.org/#rate-limits)).
10
- If you need to perform a lot of queries, you should either:
11
- - avoid bootstrap servers and use a caching client like [nicinfo](https://github.com/arineng/nicinfo)
12
- - or run [your own bootstrap server](https://github.com/arineng/rdap_bootstrap_server).
13
-
14
- ## Installation
15
-
16
- Add this line to your application's Gemfile:
17
-
18
- ```ruby
19
- gem 'rdap'
20
- ```
21
-
22
- And then execute:
23
-
24
- $ bundle install
25
-
26
- Or install it yourself as:
27
-
28
- $ gem install rdap
29
-
30
- ## Usage
31
-
32
- You can use `bin/console` from this repository for an interactive prompt.
33
-
34
- ```ruby
35
- RDAP.domain("google.com")
36
- # => {"objectClassName"=>"domain",
37
- # "handle"=>"2138514_DOMAIN_COM-VRSN",
38
- # "ldhName"=>"GOOGLE.COM",
39
- # "links"=>[...],
40
- # "status"=>[...],
41
- # "entities"=>[...],
42
- # "events"=>
43
- # [{"eventAction"=>"registration", "eventDate"=>"1997-09-15T04:00:00Z"},
44
- # {"eventAction"=>"expiration", "eventDate"=>"2028-09-14T04:00:00Z"},
45
- # {"eventAction"=>"last update of RDAP database", "eventDate"=>"2021-12-17T11:35:32Z"}],
46
- # "secureDNS"=>{"delegationSigned"=>false},
47
- # "nameservers"=>
48
- # [{"objectClassName"=>"nameserver", "ldhName"=>"NS1.GOOGLE.COM"},
49
- # {"objectClassName"=>"nameserver", "ldhName"=>"NS2.GOOGLE.COM"},
50
- # {"objectClassName"=>"nameserver", "ldhName"=>"NS3.GOOGLE.COM"},
51
- # {"objectClassName"=>"nameserver", "ldhName"=>"NS4.GOOGLE.COM"}],
52
- # "rdapConformance"=>
53
- # ["rdap_level_0", "icann_rdap_technical_implementation_guide_0", "icann_rdap_response_profile_0"],
54
- # "notices"=>[...]}
55
- RDAP.ip("8.8.8.8") # IPv4
56
- RDAP.ip("2620:119:35::35") # or IPv6
57
- RDAP.as("16276") # AS Number ("autnum" in RDAP phraseology)
58
-
59
- # there is also a lower level method accepting a type (:domain, :ip, :autnum) if needed
60
- RDAP.query("16276", type: :autnum)
61
-
62
- # Options
63
- RDAP.domain("google.com", server: "https://rdap-bootstrap.arin.net/bootstrap") # Specify an alternative bootstrap server
64
- RDAP.domain("google.com", server: "https://rdap.verisign.com/com/v1") # Or directly the target RDAP server if you know it
65
- RDAP.domain("google.com", timeout: 20) # Customize open and read timeouts (default = 5 sec each)
66
- RDAP.domain("google.com", headers: {'User-Agent' => 'My application name'}) # Override some HTTP request headers. Default headers are in RDAP::HEADERS
67
-
68
- # Error handling
69
- RDAP.domain("test.fr") # TLD not supported yet
70
- # => RDAP::NotFound ([404] domain test.fr not found in IANA boostrap file)
71
- RDAP.domain("jsiqpmcurt.design") # Domain not found
72
- # => RDAP::NotFound ([404] Object not found)
73
- RDAP.domain("jsiqpmcurt.com") # The message is not always exactly the same
74
- # => RDAP::NotFound ([404] Not Found)
75
- RDAP.domain("u$&~(!*@&@^#}") # Invalid URI
76
- # => URI::InvalidURIError (bad URI(is not URI?): "https://rdap.org/domain/u$&~(!*@&@^#}")
77
- RDAP.domain("broken") # Other type of unexpected server response
78
- # => RDAP::ServerError ([500] Internal Server Error)
79
- ```
80
-
81
- ## How does it work
82
-
83
- The gem make a query to one of the publicly available RDAP bootstrap server (their responsibility is simply to check the [bootstrap files](https://data.iana.org/rdap/dns.json) and redirect you to the proper RDAP server), then it does the query to the target RDAP server and returns the JSON parsed. The gem currently use this public bootstrap server: https://rdap.org/ but it's possible to change for another one in case of problem or limitation. For example ARIN has it's own bootstrap server too: https://rdap-bootstrap.arin.net/bootstrap. It's also possible to host your own bootstrap server.
84
-
85
- ## Changelog
86
-
87
- - **0.1.5** (2022-12-29) - Add `application/json, */*` fallback Accept types to support rdap.nic.fr which does not like `application/rdap+json` (as of 2022-12-29). I also contacted them to report this issue.
88
- - **0.1.4** (2022-02-01) - Wrap JSON parser errors as RDAP::InvalidReponse and also raise RDAP::EmptyResponse when body is missing
89
- - **0.1.3** (2022-01-10) - Wrap SSL errors as RDAP::SSLError < ServerError < Error
90
- - **0.1.2** (2022-01-07) - Added HTTP headers customization
91
- - **0.1.1** (2021-12-19) - Added TooManyRequests expection in case of 429
92
- - **0.1.0** (2021-12-17) - Initial version
93
-
94
- ## Contributing
95
-
96
- Bug reports and pull requests are welcome on GitHub at https://github.com/jarthod/rdap.
97
-
98
- After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
99
-
100
- Tests are using the `vcr` gem to record server responses so we don't hit them too quickly/often. This is nice and fast but if the server API even changes we may not notice it. So from time to time it can be intereting to re-record the responses: `rm -R spec/fixtures && rake spec`
101
-
102
- ## Alternatives
103
-
104
- If you're looking for a command line tool, you can check the excellent [nicinfo](https://github.com/arineng/nicinfo) (also written in Ruby).
105
- Also if you're just looking for one-off debugging and scripts, you can query a bootstrap endpoint directly using `curl -L`, example:
106
-
107
- ```
108
- > curl -L https://rdap-bootstrap.arin.net/bootstrap/domain/google.com
109
- {"objectClassName":"domain","handle":"2138514_DOMAIN_COM-VRSN","ldhName":"GOOGLE.COM","links":[{"value":"https:\/\/rdap.verisign.com\/com\/v1\/domain\/GOOGLE.COM","rel":"self","href":"https:\/\/rdap.verisign.com\/com\/v1\/domain\/GOOGLE.COM","type":"application\/rdap+json"},{"value":"https:\/\/rdap.markmonitor.com\/rdap\/domain\/GOOGLE.COM","rel":"related","href":"https:\/\/rdap.markmonitor.com\/rdap\/domain\/GOOGLE.COM","type":"application\/rdap+json"}],"status":["client delete prohibited","client transfer prohibited","client update prohibited","server delete prohibited","server transfer prohibited","server update prohibited"],"entities":[{"objectClassName":"entity","handle":"292","roles":["registrar"],"publicIds":[{"type":"IANA Registrar ID","identifier":"292"}],"vcardArray":["vcard",[["version",{},"text","4.0"],["fn",{},"text","MarkMonitor Inc."]]],"entities":[{"objectClassName":"entity","roles":["abuse"],"vcardArray":["vcard",[["version",{},"text","4.0"],["fn",{},"text",""],["tel",{"type":"voice"},"uri","tel:+1.2083895740"],["email",{},"text","abusecomplaints@markmonitor.com"]]]}]}],"events":[{"eventAction":"registration","eventDate":"1997-09-15T04:00:00Z"},{"eventAction":"expiration","eventDate":"2028-09-14T04:00:00Z"},{"eventAction":"last update of RDAP database","eventDate":"2021-12-17T11:35:32Z"}],"secureDNS":{"delegationSigned":false},"nameservers":[{"objectClassName":"nameserver","ldhName":"NS1.GOOGLE.COM"},{"objectClassName":"nameserver","ldhName":"NS2.GOOGLE.COM"},{"objectClassName":"nameserver","ldhName":"NS3.GOOGLE.COM"},{"objectClassName":"nameserver","ldhName":"NS4.GOOGLE.COM"}],"rdapConformance":["rdap_level_0","icann_rdap_technical_implementation_guide_0","icann_rdap_response_profile_0"],"notices":[{"title":"Terms of Use","description":["Service subject to Terms of Use."],"links":[{"href":"https:\/\/www.verisign.com\/domain-names\/registration-data-access-protocol\/terms-service\/index.xhtml","type":"text\/html"}]},{"title":"Status Codes","description":["For more information on domain status codes, please visit https:\/\/icann.org\/epp"],"links":[{"href":"https:\/\/icann.org\/epp","type":"text\/html"}]},{"title":"RDDS Inaccuracy Complaint Form","description":["URL of the ICANN RDDS Inaccuracy Complaint Form: https:\/\/icann.org\/wicf"],"links":[{"href":"https:\/\/icann.org\/wicf","type":"text\/html"}]}]}
110
- ```