redns 0.1.13 → 0.1.14
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/Rakefile +0 -13
- data/VERSION +1 -1
- data/lib/redns/connection.rb +17 -7
- data/redns.gemspec +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -25,19 +25,6 @@ Rake::TestTask.new(:test) do |test|
|
|
25
25
|
test.verbose = true
|
26
26
|
end
|
27
27
|
|
28
|
-
begin
|
29
|
-
require 'rcov/rcovtask'
|
30
|
-
Rcov::RcovTask.new do |test|
|
31
|
-
test.libs << 'test'
|
32
|
-
test.pattern = 'test/**/test_*.rb'
|
33
|
-
test.verbose = true
|
34
|
-
end
|
35
|
-
rescue LoadError
|
36
|
-
task :rcov do
|
37
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
28
|
task :test => :check_dependencies
|
42
29
|
|
43
30
|
task :default => :test
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.14
|
data/lib/redns/connection.rb
CHANGED
@@ -45,19 +45,27 @@ class ReDNS::Connection < EventMachine::Connection
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
# Returns the configured list of nameservers as an Array. If not configured
|
49
|
+
# specifically, will look in the resolver configuration file, typically
|
50
|
+
# /etc/resolv.conf for which servers to use.
|
52
51
|
def nameservers
|
53
52
|
@nameservers ||= ReDNS::Support.default_nameservers
|
54
53
|
end
|
55
|
-
|
54
|
+
|
55
|
+
# Configure the nameservers to use. Supplied value can be either a string
|
56
|
+
# containing one IP address, an Array containing multiple IP addresses, or
|
57
|
+
# nil which reverts to defaults.
|
56
58
|
def nameservers=(*list)
|
57
59
|
@nameservers = list.flatten.compact
|
58
60
|
@nameservers = nil if (list.empty?)
|
59
61
|
end
|
60
62
|
|
63
|
+
# Picks a random nameserver from the configured list=
|
64
|
+
def random_nameserver
|
65
|
+
nameservers[rand(nameservers.length)]
|
66
|
+
end
|
67
|
+
|
68
|
+
# Returns the current port in use.
|
61
69
|
def port
|
62
70
|
Socket.unpack_sockaddr_in(get_sockname)[0]
|
63
71
|
end
|
@@ -70,8 +78,10 @@ class ReDNS::Connection < EventMachine::Connection
|
|
70
78
|
|
71
79
|
# If the request was made for a specific type of record...
|
72
80
|
if (type = callback[:type])
|
73
|
-
|
74
|
-
|
81
|
+
if (type != :any)
|
82
|
+
# ...only include that type of answer in the result set.
|
83
|
+
answers = answers.select { |a| a.rtype == type }
|
84
|
+
end
|
75
85
|
end
|
76
86
|
|
77
87
|
callback[:callback].call(answers)
|
data/redns.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{redns}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.14"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["tadman"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-08-02}
|
13
13
|
s.description = %q{ReDNS is a pure Ruby DNS library with drivers for reactor-model engines such as EventMachine}
|
14
14
|
s.email = %q{github@tadman.ca}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: redns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.14
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- tadman
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-02 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|