rdap 0.1.5 → 1.0.1

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/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
- ```
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "rdap"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/rdap.gemspec DELETED
@@ -1,19 +0,0 @@
1
- require_relative 'lib/rdap'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "rdap"
5
- spec.version = RDAP::VERSION
6
- spec.authors = ["Adrien Rey-Jarthon"]
7
- spec.email = ["jobs@adrienjarthon.com"]
8
-
9
- spec.summary = %q{A minimal Ruby client to query RDAP APIs though a bootstrap server}
10
- spec.homepage = "https://github.com/jarthod/rdap"
11
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
12
-
13
- # Specify which files should be added to the gem when it is released.
14
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
15
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
16
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
- end
18
- spec.require_paths = ["lib"]
19
- end