reversed 0.3.0 → 0.4.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 +13 -5
- data/LICENSE.txt +1 -1
- data/README.md +17 -9
- data/lib/reversed/version.rb +1 -1
- data/lib/reversed.rb +11 -3
- metadata +9 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd9f6328cbd5be97594a5bae2f2a48506628cf6fcf17924408442647cccc27e2
|
4
|
+
data.tar.gz: 5adcd195cfd69de89460f51c2306058e124f41d5db714a2970cf4ef555bf13c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b67e975eee622d55fdd878888e7e1049091f253a50aceb388d9b943bb71d738d13107752b014c07fbb418c67a29b81377ca18cb8732fe6e7758bfeb96c94e34f
|
7
|
+
data.tar.gz: 797949b1d5ce6a8535bbe63b28e9f565e887cc205aaf719b81e33f3b6b28f57c1e73404f0a50a3f96f343565d4c3ccc4417423069fd3fbaf765952651b6f3c66
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.4.1 (2022-12-28)
|
2
|
+
|
3
|
+
- Added `fallback` option
|
4
|
+
|
5
|
+
## 0.4.0 (2022-06-12)
|
6
|
+
|
7
|
+
- Dropped support for Ruby < 2.7
|
8
|
+
|
9
|
+
## 0.3.0 (2019-10-28)
|
2
10
|
|
3
11
|
- Added support for machines with IPv6 disabled
|
4
12
|
- Raise `ArgumentError` for invalid IP
|
5
13
|
|
6
|
-
## 0.2.1
|
14
|
+
## 0.2.1 (2017-05-08)
|
7
15
|
|
8
16
|
- Added `timeout` and `nameservers` options
|
9
17
|
|
10
|
-
## 0.2.0
|
18
|
+
## 0.2.0 (2017-01-09)
|
11
19
|
|
12
20
|
- Removed unnecessary dependency
|
13
21
|
|
14
|
-
## 0.1.1
|
22
|
+
## 0.1.1 (2016-11-14)
|
15
23
|
|
16
24
|
- Use machine nameservers
|
17
25
|
|
18
|
-
## 0.1.0
|
26
|
+
## 0.1.0 (2016-11-14)
|
19
27
|
|
20
28
|
- First release
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -14,20 +14,14 @@ Reversed.lookup("2a03:2880:2110:df07:face:b00c::1")
|
|
14
14
|
# "a.ns.facebook.com"
|
15
15
|
```
|
16
16
|
|
17
|
-
[![Build Status](https://
|
17
|
+
[![Build Status](https://github.com/ankane/reversed/workflows/build/badge.svg?branch=master)](https://github.com/ankane/reversed/actions)
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
21
21
|
Add this line to your application’s Gemfile:
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
gem
|
25
|
-
```
|
26
|
-
|
27
|
-
And then execute:
|
28
|
-
|
29
|
-
```sh
|
30
|
-
bundle
|
24
|
+
gem "reversed"
|
31
25
|
```
|
32
26
|
|
33
27
|
## Reference
|
@@ -41,7 +35,13 @@ Reversed.lookup(ip, timeout: 3)
|
|
41
35
|
Set nameservers
|
42
36
|
|
43
37
|
```ruby
|
44
|
-
Reversed.lookup(ip, nameservers: ["
|
38
|
+
Reversed.lookup(ip, nameservers: ["1.1.1.1"])
|
39
|
+
```
|
40
|
+
|
41
|
+
Disable SOA fallback (only check PTR record) [unreleased]
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
Reversed.lookup(ip, fallback: false)
|
45
45
|
```
|
46
46
|
|
47
47
|
## History
|
@@ -57,3 +57,11 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
57
57
|
- Write, clarify, or fix documentation
|
58
58
|
- Suggest or add new features
|
59
59
|
|
60
|
+
To get started with development:
|
61
|
+
|
62
|
+
```sh
|
63
|
+
git clone https://github.com/ankane/reversed.git
|
64
|
+
cd reversed
|
65
|
+
bundle install
|
66
|
+
bundle exec rake test
|
67
|
+
```
|
data/lib/reversed/version.rb
CHANGED
data/lib/reversed.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
|
1
|
+
# dependencies
|
2
2
|
require "net/dns"
|
3
|
+
|
4
|
+
# stdlib
|
3
5
|
require "ipaddr"
|
4
6
|
|
7
|
+
# modules
|
8
|
+
require "reversed/version"
|
9
|
+
|
5
10
|
module Reversed
|
6
|
-
def self.lookup(ip, timeout: 5, nameservers: nil)
|
11
|
+
def self.lookup(ip, timeout: 5, nameservers: nil, fallback: true)
|
7
12
|
ip = ip.to_s
|
8
13
|
unless ip.empty?
|
9
14
|
begin
|
@@ -20,7 +25,10 @@ module Reversed
|
|
20
25
|
options[:nameservers] = nameservers if nameservers
|
21
26
|
begin
|
22
27
|
resolver = Net::DNS::Resolver.new(options).search(ip.reverse, Net::DNS::PTR)
|
23
|
-
answer = resolver.answer.first
|
28
|
+
answer = resolver.answer.first
|
29
|
+
if !answer && fallback
|
30
|
+
answer = resolver.authority.first
|
31
|
+
end
|
24
32
|
if answer && !answer.value.empty?
|
25
33
|
answer.value.split(" ").first[0..-2]
|
26
34
|
end
|
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.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-dns
|
@@ -24,50 +24,8 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
|
28
|
-
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '5'
|
69
|
-
description:
|
70
|
-
email: andrew@chartkick.com
|
27
|
+
description:
|
28
|
+
email: andrew@ankane.org
|
71
29
|
executables: []
|
72
30
|
extensions: []
|
73
31
|
extra_rdoc_files: []
|
@@ -81,7 +39,7 @@ homepage: https://github.com/ankane/reversed
|
|
81
39
|
licenses:
|
82
40
|
- MIT
|
83
41
|
metadata: {}
|
84
|
-
post_install_message:
|
42
|
+
post_install_message:
|
85
43
|
rdoc_options: []
|
86
44
|
require_paths:
|
87
45
|
- lib
|
@@ -89,15 +47,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
47
|
requirements:
|
90
48
|
- - ">="
|
91
49
|
- !ruby/object:Gem::Version
|
92
|
-
version: '2.
|
50
|
+
version: '2.7'
|
93
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
52
|
requirements:
|
95
53
|
- - ">="
|
96
54
|
- !ruby/object:Gem::Version
|
97
55
|
version: '0'
|
98
56
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
100
|
-
signing_key:
|
57
|
+
rubygems_version: 3.4.1
|
58
|
+
signing_key:
|
101
59
|
specification_version: 4
|
102
60
|
summary: Reverse DNS / IP Lookup for Ruby
|
103
61
|
test_files: []
|