reversed 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -0
- data/lib/reversed.rb +15 -4
- data/lib/reversed/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a0f5332c4c10206b8d14fc18a84d8faf2469fd
|
4
|
+
data.tar.gz: e2845ea93f46a5cee9321874b8be2f712c6171a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb064aded74596ddb6c2520a381ec28de82abf3b56fc91f640bed215ca0f2c7d1fcd6219dfedf48d622987749e0e91abef7966dc44691dc534f13e0afd421be
|
7
|
+
data.tar.gz: 81c4f5a32c44a2613401bb8fefc6a8f029959e784fb597d91dc0d4cee3705cc00157f8e17f8785a73cf2095b08bbfc1eb26f0ce97fafa5f0b3bf60f9e20dd58b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/reversed.rb
CHANGED
@@ -2,12 +2,23 @@ require "reversed/version"
|
|
2
2
|
require "net/dns"
|
3
3
|
|
4
4
|
module Reversed
|
5
|
-
def self.lookup(ip)
|
5
|
+
def self.lookup(ip, timeout: 5, nameservers: nil)
|
6
6
|
ip = ip.to_s
|
7
7
|
unless ip.empty?
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
options = {
|
9
|
+
retry: 3,
|
10
|
+
udp_timeout: timeout
|
11
|
+
}
|
12
|
+
options[:nameservers] = nameservers if nameservers
|
13
|
+
begin
|
14
|
+
resolver = Net::DNS::Resolver.new(options).search(ip)
|
15
|
+
answer = resolver.answer.first || resolver.authority.first
|
16
|
+
if answer && !answer.value.empty?
|
17
|
+
answer.value.split(" ").first[0..-2]
|
18
|
+
end
|
19
|
+
rescue Net::DNS::Resolver::NoResponseError
|
20
|
+
nil
|
21
|
+
end
|
11
22
|
end
|
12
23
|
end
|
13
24
|
end
|
data/lib/reversed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reversed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-dns
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.6.
|
103
|
+
rubygems_version: 2.6.11
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Reverse DNS / IP Lookup for Ruby
|