donas 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +111 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/donas +51 -0
- data/bin/setup +8 -0
- data/donas.gemspec +26 -0
- data/lib/donas.rb +80 -0
- data/lib/donas/errors.rb +4 -0
- data/lib/donas/version.rb +3 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4dbe3c120b24bcae4e4bbf290453a21a4897b5fd
|
4
|
+
data.tar.gz: 7af73d69dacf17235f0579b7ef2994861ae74a83
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fa24b51a4fce44b85c947145816a4544b16824bb5da7dcf536afcd574faad95f662a9b393682c88bf7a5f2803991da4c5587766ecdde1fb330e97432b4f03a92
|
7
|
+
data.tar.gz: e73809c6ce04c52f2e1b4de0c91b85c4e9316c910e6ace8438eae7c56991987a6b090b7da8ab8b2a5d6acb76aa1349cba442d8371bf6a6d27aad15b5309ca472
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at ernesto+github@ombulabs.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 The Lean Software Boutique LLC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
# Donas
|
2
|
+
|
3
|
+
Easily find DNS details for a domain or subdomain: Name servers, MX records, IP resolution.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
With Bundler:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'donas'
|
11
|
+
```
|
12
|
+
|
13
|
+
Without Bundler:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
gem install donas
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Command Line
|
22
|
+
|
23
|
+
If you want to use the command line tool:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ donas ombushop.com
|
27
|
+
Domain: ombushop.com
|
28
|
+
IP: 50.16.228.254
|
29
|
+
|
30
|
+
Name servers:
|
31
|
+
ns-1222.awsdns-24.org
|
32
|
+
ns-2028.awsdns-61.co.uk
|
33
|
+
ns-38.awsdns-04.com
|
34
|
+
ns-779.awsdns-33.net
|
35
|
+
|
36
|
+
MX records:
|
37
|
+
1 aspmx.l.google.com
|
38
|
+
10 aspmx2.googlemail.com
|
39
|
+
10 aspmx3.googlemail.com
|
40
|
+
5 alt1.aspmx.l.google.com
|
41
|
+
5 alt2.aspmx.l.google.com
|
42
|
+
```
|
43
|
+
|
44
|
+
If you want to use it in your application:
|
45
|
+
|
46
|
+
### DNS Records
|
47
|
+
|
48
|
+
This will return A, TXT, NS and CNAME records.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
> Donas.get_record "ombulabs.com"
|
52
|
+
=> #<Resolv::DNS::Resource::IN::A:0x007f831d16c220 @address=#<Resolv::IPv4 50.16.228.254>, @ttl=59>
|
53
|
+
> Donas.get_record "shop.ombulabs.com"
|
54
|
+
=> #<Resolv::DNS::Resource::IN::CNAME:0x007f831d3174a8 @name=#<Resolv::DNS::Name: tiendaombulabs.ombushop.com.>, @ttl=21277>
|
55
|
+
> Donas.get_records "ombushop.com"
|
56
|
+
=> [#<Resolv::DNS::Resource::IN::A:0x007f831d81ff18 @address=#<Resolv::IPv4 50.16.228.254>, @ttl=3599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d81f540 @name=#<Resolv::DNS::Name: ns-1222.awsdns-24.org.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d81eaa0 @name=#<Resolv::DNS::Name: ns-2028.awsdns-61.co.uk.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d81df88 @name=#<Resolv::DNS::Name: ns-38.awsdns-04.com.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d81d5b0 @name=#<Resolv::DNS::Name: ns-779.awsdns-33.net.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::SOA:0x007f831d81c390 @mname=#<Resolv::DNS::Name: ns-1222.awsdns-24.org.>, @rname=#<Resolv::DNS::Name: awsdns-hostmaster.amazon.com.>, @serial=1, @refresh=7200, @retry=900, @expire=1209600, @minimum=86400, @ttl=899>, #<Resolv::DNS::Resource::IN::MX:0x007f831d827f38 @preference=1, @exchange=#<Resolv::DNS::Name: aspmx.l.google.com.>, @ttl=299>, #<Resolv::DNS::Resource::IN::MX:0x007f831d827308 @preference=10, @exchange=#<Resolv::DNS::Name: aspmx2.googlemail.com.>, @ttl=299>, #<Resolv::DNS::Resource::IN::MX:0x007f831d826598 @preference=10, @exchange=#<Resolv::DNS::Name: aspmx3.googlemail.com.>, @ttl=299>, #<Resolv::DNS::Resource::IN::MX:0x007f831d825698 @preference=5, @exchange=#<Resolv::DNS::Name: alt1.aspmx.l.google.com.>, @ttl=299>, #<Resolv::DNS::Resource::IN::MX:0x007f831d824798 @preference=5, @exchange=#<Resolv::DNS::Name: alt2.aspmx.l.google.com.>, @ttl=299>, #<Resolv::DNS::Resource::IN::TXT:0x007f831d824018 @strings=["v=spf1 include:_spf.google.com ~all"], @ttl=3599>, #<Resolv::DNS::Resource::IN::TXT:0x007f831d0f5a58 @strings=["v=spf1 include:sendgrid.net ~all"], @ttl=3599>, #<Resolv::DNS::Resource::Generic::Type99_Class1:0x007f831d82f9b8 @data="#v=spf1 include:_spf.google.com ~all", @ttl=3599>]
|
57
|
+
```
|
58
|
+
|
59
|
+
### IP Addresses
|
60
|
+
|
61
|
+
This will return an IP address, even if the initial record is a CNAME.
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
> Donas.get_address "shop.ombulabs.com"
|
65
|
+
=> #<Resolv::IPv4 50.16.228.254>
|
66
|
+
```
|
67
|
+
|
68
|
+
### MX Records
|
69
|
+
|
70
|
+
This will return the MX records for a domain.
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
> Donas.mx_records "ombulabs.com"
|
74
|
+
=> [#<Resolv::DNS::Resource::IN::MX:0x007f831c35eb60 @preference=1, @exchange=#<Resolv::DNS::Name: aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c35dc60 @preference=10, @exchange=#<Resolv::DNS::Name: alt3.aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c35cd60 @preference=10, @exchange=#<Resolv::DNS::Name: alt4.aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831d114f70 @preference=5, @exchange=#<Resolv::DNS::Name: alt1.aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c3670f8 @preference=5, @exchange=#<Resolv::DNS::Name: alt2.aspmx.l.google.com.>, @ttl=3599>]
|
75
|
+
```
|
76
|
+
|
77
|
+
### Name Servers
|
78
|
+
|
79
|
+
This will return the name servers for the main domain (even if you provide a subdomain)
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
> Donas.nameservers "ombulabs.com"
|
83
|
+
=> [#<Resolv::DNS::Resource::IN::NS:0x007f831d32e7c0 @name=#<Resolv::DNS::Name: ns-1052.awsdns-03.org.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d32dd20 @name=#<Resolv::DNS::Name: ns-1839.awsdns-37.co.uk.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d32d208 @name=#<Resolv::DNS::Name: ns-469.awsdns-58.com.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831d32c830 @name=#<Resolv::DNS::Name: ns-665.awsdns-19.net.>, @ttl=21599>]
|
84
|
+
```
|
85
|
+
|
86
|
+
### Summary of a Domain
|
87
|
+
|
88
|
+
This will return MX and name records.
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
> Donas.summary "ombulabs.com"
|
92
|
+
=> {:nameservers=>[#<Resolv::DNS::Resource::IN::NS:0x007f831c3779d0 @name=#<Resolv::DNS::Name: ns-1052.awsdns-03.org.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831c376f30 @name=#<Resolv::DNS::Name: ns-1839.awsdns-37.co.uk.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831c376418 @name=#<Resolv::DNS::Name: ns-469.awsdns-58.com.>, @ttl=21599>, #<Resolv::DNS::Resource::IN::NS:0x007f831c375a40 @name=#<Resolv::DNS::Name: ns-665.awsdns-19.net.>, @ttl=21599>], :mx_records=>[#<Resolv::DNS::Resource::IN::MX:0x007f831c37d1c8 @preference=1, @exchange=#<Resolv::DNS::Name: aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c37c2c8 @preference=10, @exchange=#<Resolv::DNS::Name: alt3.aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c387678 @preference=10, @exchange=#<Resolv::DNS::Name: alt4.aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c386778 @preference=5, @exchange=#<Resolv::DNS::Name: alt1.aspmx.l.google.com.>, @ttl=3599>, #<Resolv::DNS::Resource::IN::MX:0x007f831c385878 @preference=5, @exchange=#<Resolv::DNS::Name: alt2.aspmx.l.google.com.>, @ttl=3599>]}
|
93
|
+
```
|
94
|
+
|
95
|
+
## Development
|
96
|
+
|
97
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
98
|
+
|
99
|
+
Then, run `rake` to run the tests.
|
100
|
+
|
101
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
102
|
+
|
103
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
104
|
+
|
105
|
+
## Contributing
|
106
|
+
|
107
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ombulabs/donas. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
108
|
+
|
109
|
+
## License
|
110
|
+
|
111
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "donas"
|
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
|
data/bin/donas
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
trap(:INT) { exit 1 }
|
5
|
+
|
6
|
+
def flunk(message)
|
7
|
+
$stderr.puts usage
|
8
|
+
$stderr.puts message
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
def summary(line)
|
13
|
+
flunk("Error: Please provide a domain.") if line.nil? || line.empty?
|
14
|
+
flunk("Error: One domain at a time.") if line.size > 1
|
15
|
+
|
16
|
+
require "donas"
|
17
|
+
|
18
|
+
domain = line.first
|
19
|
+
summ = Donas.summary domain
|
20
|
+
|
21
|
+
puts "Domain: #{domain}\n"
|
22
|
+
puts "IP: #{Donas.get_address(domain)}"
|
23
|
+
|
24
|
+
puts "\nName servers:"
|
25
|
+
show_list Donas.nameservers(domain) do |record|
|
26
|
+
puts record.name.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "\nMX records:"
|
30
|
+
show_list Donas.mx_records(domain) do |record|
|
31
|
+
puts "#{record.preference} #{record.exchange.to_s}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def show_list(records)
|
36
|
+
if records.empty?
|
37
|
+
puts "(none)"
|
38
|
+
else
|
39
|
+
records.each do |record|
|
40
|
+
yield record
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def usage
|
46
|
+
"usage: donas example.com\n"
|
47
|
+
end
|
48
|
+
|
49
|
+
###
|
50
|
+
|
51
|
+
summary(ARGV)
|
data/bin/setup
ADDED
data/donas.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'donas/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "donas"
|
8
|
+
spec.version = Donas::VERSION
|
9
|
+
spec.authors = ["Ernesto Tagwerker"]
|
10
|
+
spec.email = ["ernesto@ombulabs.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A simple gem to find DNS information for a domain}
|
13
|
+
spec.description = %q{A wrapper to resolv}
|
14
|
+
spec.homepage = "http://github.com/ombulabs/donas"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = "donas"
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "byebug", "~> 8.2"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
end
|
data/lib/donas.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require "resolv"
|
2
|
+
require "donas/errors"
|
3
|
+
require "donas/version"
|
4
|
+
|
5
|
+
class Donas
|
6
|
+
SEPARATOR = ".".freeze
|
7
|
+
|
8
|
+
# Returns an {Array} with {Resolv::DNS::Resource::IN::MX} objects.
|
9
|
+
#
|
10
|
+
# @param [String] domain
|
11
|
+
# @return [Array]
|
12
|
+
def self.mx_records(domain)
|
13
|
+
resolver.getresources(safe(domain), Resolv::DNS::Resource::IN::MX)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns an {Array} with {Resolv::DNS::Resource::IN::NS} objects.
|
17
|
+
#
|
18
|
+
# @param [String] domain
|
19
|
+
# @return [Array]
|
20
|
+
def self.nameservers(domain)
|
21
|
+
safe_domain = safe(domain)
|
22
|
+
main_domain = safe_domain.split(SEPARATOR).last(2).join(SEPARATOR)
|
23
|
+
resolver.getresources(main_domain, Resolv::DNS::Resource::IN::NS)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a record with DNS information.
|
27
|
+
#
|
28
|
+
# @param [String] domain
|
29
|
+
# @return [Resolv::DNS::Resource::IN::A,Resolv::DNS::Resource::IN::CNAME,Resolv::DNS::Resource::IN::TXT]
|
30
|
+
# @raise [Resolv::ResolvError]
|
31
|
+
def self.get_record(domain)
|
32
|
+
resolver.getresource(safe(domain), Resolv::DNS::Resource::IN::ANY)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns a {Resolv::IPv4} or {Resolv::IPv6} object for the domain.
|
36
|
+
#
|
37
|
+
# @param [String] domain
|
38
|
+
# @return [Resolv::IPv4, Resolv::IPv6]
|
39
|
+
# @raise [Resolv::ResolvError]
|
40
|
+
def self.get_address(domain)
|
41
|
+
record = get_record(safe(domain))
|
42
|
+
|
43
|
+
if record.respond_to? :address
|
44
|
+
record.address
|
45
|
+
else
|
46
|
+
get_address(record.name.to_s)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns an {Array} with {Resolv::DNS::Resource::IN::A},
|
51
|
+
# {Resolv::DNS::Resource::IN::CNAME}, {Resolv::DNS::Resource::IN::TXT}
|
52
|
+
# objects.
|
53
|
+
#
|
54
|
+
# @param [String] domain
|
55
|
+
# @return [Array]
|
56
|
+
def self.get_records(domain)
|
57
|
+
resolver.getresources(safe(domain), Resolv::DNS::Resource::IN::ANY)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns a {Hash} with all the information about the DNS records of a domain
|
61
|
+
#
|
62
|
+
# @param [String] domain
|
63
|
+
# @return [Hash]
|
64
|
+
def self.summary(domain)
|
65
|
+
{
|
66
|
+
nameservers: nameservers(domain),
|
67
|
+
mx_records: mx_records(domain)
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.resolver
|
72
|
+
Resolv::DNS.new
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.safe(domain)
|
76
|
+
names = domain.split(SEPARATOR)
|
77
|
+
raise BadFormatError.new("#{domain} not valid") if names.size < 2
|
78
|
+
domain
|
79
|
+
end
|
80
|
+
end
|
data/lib/donas/errors.rb
ADDED
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: donas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ernesto Tagwerker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '8.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '8.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: A wrapper to resolv
|
70
|
+
email:
|
71
|
+
- ernesto@ombulabs.com
|
72
|
+
executables:
|
73
|
+
- donas
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- CODE_OF_CONDUCT.md
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/donas
|
87
|
+
- bin/setup
|
88
|
+
- donas.gemspec
|
89
|
+
- lib/donas.rb
|
90
|
+
- lib/donas/errors.rb
|
91
|
+
- lib/donas/version.rb
|
92
|
+
homepage: http://github.com/ombulabs/donas
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.4.6
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: A simple gem to find DNS information for a domain
|
116
|
+
test_files: []
|