async-dns 1.2.3 → 1.3.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/dns/handler.rb +2 -2
- data/lib/async/dns/resolver.rb +2 -2
- data/lib/async/dns/server.rb +1 -1
- data/lib/async/dns/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +79 -76
- metadata.gz.sig +4 -0
- data/.editorconfig +0 -6
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/.travis.yml +0 -27
- data/Gemfile +0 -18
- data/README.md +0 -148
- data/Rakefile +0 -32
- data/async-dns.gemspec +0 -31
- data/examples/cloudflare.rb +0 -24
- data/spec/async/dns/handler_spec.rb +0 -60
- data/spec/async/dns/hosts.txt +0 -2
- data/spec/async/dns/ipv6_spec.rb +0 -78
- data/spec/async/dns/junk_server_context.rb +0 -62
- data/spec/async/dns/message_spec.rb +0 -56
- data/spec/async/dns/origin_spec.rb +0 -106
- data/spec/async/dns/replace_spec.rb +0 -44
- data/spec/async/dns/resolver_performance_spec.rb +0 -106
- data/spec/async/dns/resolver_spec.rb +0 -104
- data/spec/async/dns/server/bind9/generate-local.rb +0 -25
- data/spec/async/dns/server/bind9/local.zone +0 -5014
- data/spec/async/dns/server/bind9/named.conf +0 -14
- data/spec/async/dns/server/bind9/named.run +0 -0
- data/spec/async/dns/server/million.rb +0 -83
- data/spec/async/dns/server_performance_spec.rb +0 -159
- data/spec/async/dns/slow_server_spec.rb +0 -97
- data/spec/async/dns/socket_spec.rb +0 -72
- data/spec/async/dns/system_spec.rb +0 -57
- data/spec/async/dns/transaction_spec.rb +0 -140
- data/spec/async/dns/truncation_spec.rb +0 -61
- data/spec/spec_helper.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82551b95c437170352dfde80210008c1a9df9bebcbf750b1d5b51e064f0b8f43
|
4
|
+
data.tar.gz: e02fdbd72153bee022c157d9855a60a10db6da9b7067a5159db089ebc8fd63b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4de0e486a37755904384a41685aabd850a9a86f41bb7371f1c2986779bbad06c4bbb3488e2f9e47724bb11832867efbc04c3d1676fa28c737266416b8336215
|
7
|
+
data.tar.gz: 7093b96f0f8bcf457ac88e03fff520298a359ed55d99f69b05453410d0e89703e7e6090720583ac223bf29b3f0e9300f31e46eab91f86f862ccf671cbe7ea824
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/async/dns/handler.rb
CHANGED
@@ -28,7 +28,7 @@ module Async::DNS
|
|
28
28
|
@server = server
|
29
29
|
@socket = socket
|
30
30
|
|
31
|
-
@logger = @server.logger ||
|
31
|
+
@logger = @server.logger || Console.logger
|
32
32
|
end
|
33
33
|
|
34
34
|
attr :server
|
@@ -59,7 +59,7 @@ module Async::DNS
|
|
59
59
|
|
60
60
|
return @server.process_query(query, options)
|
61
61
|
rescue StandardError => error
|
62
|
-
@logger.error(error
|
62
|
+
@logger.error(self) { error }
|
63
63
|
|
64
64
|
return error_response(query)
|
65
65
|
end
|
data/lib/async/dns/resolver.rb
CHANGED
@@ -46,7 +46,7 @@ module Async::DNS
|
|
46
46
|
# Servers are specified in the same manor as options[:listen], e.g.
|
47
47
|
# [:tcp/:udp, address, port]
|
48
48
|
# In the case of multiple servers, they will be checked in sequence.
|
49
|
-
def initialize(endpoints, origin: nil, logger:
|
49
|
+
def initialize(endpoints, origin: nil, logger: Console.logger, timeout: DEFAULT_TIMEOUT)
|
50
50
|
@endpoints = endpoints
|
51
51
|
|
52
52
|
@origin = origin
|
@@ -203,7 +203,7 @@ module Async::DNS
|
|
203
203
|
elsif response.id != message.id
|
204
204
|
@logger.warn "[#{message.id}] Received response with incorrect message id: #{response.id}!" if @logger
|
205
205
|
else
|
206
|
-
@logger.debug "[#{message.id}] Received valid response with #{response.answer.
|
206
|
+
@logger.debug "[#{message.id}] Received valid response with #{response.answer.size} answer(s)." if @logger
|
207
207
|
|
208
208
|
return true
|
209
209
|
end
|
data/lib/async/dns/server.rb
CHANGED
@@ -36,7 +36,7 @@ module Async::DNS
|
|
36
36
|
# end
|
37
37
|
# end
|
38
38
|
#
|
39
|
-
def initialize(endpoints = DEFAULT_ENDPOINTS, origin: '.', logger:
|
39
|
+
def initialize(endpoints = DEFAULT_ENDPOINTS, origin: '.', logger: Console.logger)
|
40
40
|
@endpoints = endpoints
|
41
41
|
@origin = origin
|
42
42
|
@logger = logger
|
data/lib/async/dns/version.rb
CHANGED
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
|
14
|
+
ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
|
15
|
+
MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
|
16
|
+
aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
|
17
|
+
AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
|
18
|
+
xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
|
19
|
+
eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
|
20
|
+
L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlrJHn
|
21
|
+
9iZEZ7AxrS7vokhMlzSr/XMUihx/8aFKtk+tMLClqxZSmBWIErWdicCGTULXCBNb
|
22
|
+
E/mljo4zEVKhlTWpJklMIhr55ZRrSarKFuW7en0+tpJrfsYiAmXMJNi4XAYJH7uL
|
23
|
+
rgJuJwSaa/dMz+VmUoo7VKtSfCoOI+6v5/z0sK3oT6sG6ZwyI47DBq2XqNC6tnAj
|
24
|
+
w+XmCywiTQrFzMMAvcA7rPI4F0nU1rZId51rOvvfxaONp+wgTi4P8owZLw0/j0m4
|
25
|
+
8C20DYi6EYx4AHDXiLpElWh3AgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8E
|
26
|
+
BAMCBLAwHQYDVR0OBBYEFB6ZaeWKxQjGTI+pmz7cKRmMIywwMC4GA1UdEQQnMCWB
|
27
|
+
I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWB
|
28
|
+
I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEB
|
29
|
+
CwUAA4IBgQBVoM+pu3dpdUhZM1w051iw5GfiqclAr1Psypf16Tiod/ho//4oAu6T
|
30
|
+
9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
|
31
|
+
vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
|
32
|
+
x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
|
33
|
+
bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
|
34
|
+
Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
|
35
|
+
y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
|
36
|
+
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
37
|
+
HiLJ8VOFx6w=
|
38
|
+
-----END CERTIFICATE-----
|
39
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
40
|
dependencies:
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: async-io
|
@@ -39,21 +67,21 @@ dependencies:
|
|
39
67
|
- !ruby/object:Gem::Version
|
40
68
|
version: '1.0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
70
|
+
name: bundler
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
|
-
- - "
|
73
|
+
- - ">="
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
75
|
+
version: '0'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
|
-
- - "
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: covered
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - ">="
|
@@ -66,51 +94,68 @@ dependencies:
|
|
66
94
|
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: process-daemon
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: rspec
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
72
114
|
requirements:
|
73
115
|
- - "~>"
|
74
116
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
117
|
+
version: '3.0'
|
76
118
|
type: :development
|
77
119
|
prerelease: false
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
79
121
|
requirements:
|
80
122
|
- - "~>"
|
81
123
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
124
|
+
version: '3.0'
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
126
|
+
name: rspec-files
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
86
128
|
requirements:
|
87
|
-
- - "
|
129
|
+
- - "~>"
|
88
130
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
131
|
+
version: '1.0'
|
90
132
|
type: :development
|
91
133
|
prerelease: false
|
92
134
|
version_requirements: !ruby/object:Gem::Requirement
|
93
135
|
requirements:
|
94
|
-
- - "
|
136
|
+
- - "~>"
|
95
137
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
|
98
|
-
|
138
|
+
version: '1.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec-memory
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.0'
|
153
|
+
description:
|
99
154
|
email:
|
100
|
-
- samuel.williams@oriontransfer.co.nz
|
101
155
|
executables: []
|
102
156
|
extensions: []
|
103
157
|
extra_rdoc_files: []
|
104
158
|
files:
|
105
|
-
- ".editorconfig"
|
106
|
-
- ".gitignore"
|
107
|
-
- ".rspec"
|
108
|
-
- ".travis.yml"
|
109
|
-
- Gemfile
|
110
|
-
- README.md
|
111
|
-
- Rakefile
|
112
|
-
- async-dns.gemspec
|
113
|
-
- examples/cloudflare.rb
|
114
159
|
- lib/async/dns.rb
|
115
160
|
- lib/async/dns/chunked.rb
|
116
161
|
- lib/async/dns/extensions/resolv.rb
|
@@ -124,32 +169,11 @@ files:
|
|
124
169
|
- lib/async/dns/transaction.rb
|
125
170
|
- lib/async/dns/transport.rb
|
126
171
|
- lib/async/dns/version.rb
|
127
|
-
|
128
|
-
- spec/async/dns/hosts.txt
|
129
|
-
- spec/async/dns/ipv6_spec.rb
|
130
|
-
- spec/async/dns/junk_server_context.rb
|
131
|
-
- spec/async/dns/message_spec.rb
|
132
|
-
- spec/async/dns/origin_spec.rb
|
133
|
-
- spec/async/dns/replace_spec.rb
|
134
|
-
- spec/async/dns/resolver_performance_spec.rb
|
135
|
-
- spec/async/dns/resolver_spec.rb
|
136
|
-
- spec/async/dns/server/bind9/generate-local.rb
|
137
|
-
- spec/async/dns/server/bind9/local.zone
|
138
|
-
- spec/async/dns/server/bind9/named.conf
|
139
|
-
- spec/async/dns/server/bind9/named.run
|
140
|
-
- spec/async/dns/server/million.rb
|
141
|
-
- spec/async/dns/server_performance_spec.rb
|
142
|
-
- spec/async/dns/slow_server_spec.rb
|
143
|
-
- spec/async/dns/socket_spec.rb
|
144
|
-
- spec/async/dns/system_spec.rb
|
145
|
-
- spec/async/dns/transaction_spec.rb
|
146
|
-
- spec/async/dns/truncation_spec.rb
|
147
|
-
- spec/spec_helper.rb
|
148
|
-
homepage: https://github.com/async/async-dns
|
172
|
+
homepage: https://github.com/socketry/async-dns
|
149
173
|
licenses:
|
150
174
|
- MIT
|
151
175
|
metadata: {}
|
152
|
-
post_install_message:
|
176
|
+
post_install_message:
|
153
177
|
rdoc_options: []
|
154
178
|
require_paths:
|
155
179
|
- lib
|
@@ -164,29 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
188
|
- !ruby/object:Gem::Version
|
165
189
|
version: '0'
|
166
190
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
-
signing_key:
|
191
|
+
rubygems_version: 3.1.6
|
192
|
+
signing_key:
|
169
193
|
specification_version: 4
|
170
194
|
summary: An easy to use DNS client resolver and server for Ruby.
|
171
|
-
test_files:
|
172
|
-
- spec/async/dns/handler_spec.rb
|
173
|
-
- spec/async/dns/hosts.txt
|
174
|
-
- spec/async/dns/ipv6_spec.rb
|
175
|
-
- spec/async/dns/junk_server_context.rb
|
176
|
-
- spec/async/dns/message_spec.rb
|
177
|
-
- spec/async/dns/origin_spec.rb
|
178
|
-
- spec/async/dns/replace_spec.rb
|
179
|
-
- spec/async/dns/resolver_performance_spec.rb
|
180
|
-
- spec/async/dns/resolver_spec.rb
|
181
|
-
- spec/async/dns/server/bind9/generate-local.rb
|
182
|
-
- spec/async/dns/server/bind9/local.zone
|
183
|
-
- spec/async/dns/server/bind9/named.conf
|
184
|
-
- spec/async/dns/server/bind9/named.run
|
185
|
-
- spec/async/dns/server/million.rb
|
186
|
-
- spec/async/dns/server_performance_spec.rb
|
187
|
-
- spec/async/dns/slow_server_spec.rb
|
188
|
-
- spec/async/dns/socket_spec.rb
|
189
|
-
- spec/async/dns/system_spec.rb
|
190
|
-
- spec/async/dns/transaction_spec.rb
|
191
|
-
- spec/async/dns/truncation_spec.rb
|
192
|
-
- spec/spec_helper.rb
|
195
|
+
test_files: []
|
metadata.gz.sig
ADDED
data/.editorconfig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
dist: xenial
|
3
|
-
|
4
|
-
cache: bundler
|
5
|
-
|
6
|
-
addons:
|
7
|
-
apt:
|
8
|
-
packages:
|
9
|
-
- bind9
|
10
|
-
|
11
|
-
before_script:
|
12
|
-
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
|
13
|
-
|
14
|
-
matrix:
|
15
|
-
include:
|
16
|
-
- rvm: 2.3
|
17
|
-
- rvm: 2.4
|
18
|
-
- rvm: 2.5
|
19
|
-
- rvm: 2.6
|
20
|
-
- rvm: truffleruby
|
21
|
-
- rvm: jruby-head
|
22
|
-
env: JRUBY_OPTS="--debug -X+O"
|
23
|
-
- rvm: ruby-head
|
24
|
-
allow_failures:
|
25
|
-
- rvm: ruby-head
|
26
|
-
- rvm: truffleruby
|
27
|
-
- rvm: jruby-head
|
data/Gemfile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
group :development do
|
6
|
-
gem "pry"
|
7
|
-
end
|
8
|
-
|
9
|
-
group :test do
|
10
|
-
gem 'ruby-prof', platforms: [:mri]
|
11
|
-
gem "benchmark-ips"
|
12
|
-
|
13
|
-
gem 'simplecov'
|
14
|
-
gem 'coveralls', require: false
|
15
|
-
|
16
|
-
# For comparisons:
|
17
|
-
gem "nokogiri"
|
18
|
-
end
|
data/README.md
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
# Async::DNS
|
2
|
-
|
3
|
-
Async::DNS is a high-performance DNS client resolver and server which can be easily integrated into other projects or used as a stand-alone daemon. It was forked from [RubyDNS] which is now implemented in terms of this library.
|
4
|
-
|
5
|
-
[RubyDNS]: https://github.com/ioquatix/rubydns
|
6
|
-
|
7
|
-
[](http://travis-ci.org/socketry/async-dns)
|
8
|
-
[](https://codeclimate.com/github/socketry/async-dns)
|
9
|
-
[](https://coveralls.io/r/socketry/async-dns)
|
10
|
-
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
Add this line to your application's Gemfile:
|
14
|
-
|
15
|
-
gem 'async-dns'
|
16
|
-
|
17
|
-
And then execute:
|
18
|
-
|
19
|
-
$ bundle
|
20
|
-
|
21
|
-
Or install it yourself as:
|
22
|
-
|
23
|
-
$ gem install async-dns
|
24
|
-
|
25
|
-
## Usage
|
26
|
-
|
27
|
-
### Resolver
|
28
|
-
|
29
|
-
Here is a simple example showing how to use the resolver:
|
30
|
-
|
31
|
-
```ruby
|
32
|
-
Async::Reactor.run do
|
33
|
-
resolver = Async::DNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])
|
34
|
-
|
35
|
-
addresses = resolver.addresses_for("www.google.com.")
|
36
|
-
|
37
|
-
puts addresses.inspect
|
38
|
-
end
|
39
|
-
=> [#<Resolv::IPv4 202.124.127.240>, #<Resolv::IPv4 202.124.127.216>, #<Resolv::IPv4 202.124.127.223>, #<Resolv::IPv4 202.124.127.227>, #<Resolv::IPv4 202.124.127.234>, #<Resolv::IPv4 202.124.127.230>, #<Resolv::IPv4 202.124.127.208>, #<Resolv::IPv4 202.124.127.249>, #<Resolv::IPv4 202.124.127.219>, #<Resolv::IPv4 202.124.127.218>, #<Resolv::IPv4 202.124.127.212>, #<Resolv::IPv4 202.124.127.241>, #<Resolv::IPv4 202.124.127.238>, #<Resolv::IPv4 202.124.127.245>, #<Resolv::IPv4 202.124.127.251>, #<Resolv::IPv4 202.124.127.229>]
|
40
|
-
```
|
41
|
-
|
42
|
-
### Server
|
43
|
-
|
44
|
-
Here is a simple example showing how to use the server:
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
require 'async/dns'
|
48
|
-
|
49
|
-
class TestServer < Async::DNS::Server
|
50
|
-
def process(name, resource_class, transaction)
|
51
|
-
@resolver ||= Async::DNS::Resolver.new([[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]])
|
52
|
-
|
53
|
-
transaction.passthrough!(@resolver)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
server = TestServer.new([[:udp, '127.0.0.1', 2346]])
|
58
|
-
|
59
|
-
server.run
|
60
|
-
```
|
61
|
-
|
62
|
-
Then to test you could use `dig` like so:
|
63
|
-
|
64
|
-
dig @localhost -p 2346 google.com
|
65
|
-
|
66
|
-
## FAQ
|
67
|
-
|
68
|
-
### File Handle Limitations
|
69
|
-
|
70
|
-
I get the error `Errno::EMFILE: Too many open files - socket(2) - udp` when trying to run a server. What should I do?
|
71
|
-
|
72
|
-
On some platforms (e.g. Mac OS X) the number of file descriptors is relatively low by default and should be increased by calling `ulimit -n 10000` before running tests or even before starting a server which expects a large number of concurrent incoming connections.
|
73
|
-
|
74
|
-
### Server
|
75
|
-
|
76
|
-
The performance is on the same magnitude as `bind9`. Some basic benchmarks resolving 1000 names concurrently, repeated 5 times, using `Async::DNS::Resolver` gives the following:
|
77
|
-
|
78
|
-
user system total real
|
79
|
-
Async::DNS::Server 4.280000 0.450000 4.730000 ( 4.854862)
|
80
|
-
Bind9 4.970000 0.520000 5.490000 ( 5.541213)
|
81
|
-
|
82
|
-
These benchmarks are included in the unit tests. To test bind9 performance, it must be installed and `which named` must return the executable.
|
83
|
-
|
84
|
-
|
85
|
-
## Performance
|
86
|
-
|
87
|
-
We welcome additional benchmarks and feedback regarding Async::DNS performance. To check the current performance results, consult the [travis build job output](https://travis-ci.org/socketry/async-dns).
|
88
|
-
|
89
|
-
### Resolver
|
90
|
-
|
91
|
-
The `Async::DNS::Resolver` is highly concurrent and can resolve individual names as fast as the built in `Resolv::DNS` resolver. Because the resolver is asynchronous, when dealing with multiple names, it can work more efficiently:
|
92
|
-
|
93
|
-
user system total real
|
94
|
-
Async::DNS::Resolver 0.020000 0.010000 0.030000 ( 0.030507)
|
95
|
-
Resolv::DNS 0.070000 0.010000 0.080000 ( 1.465975)
|
96
|
-
|
97
|
-
These benchmarks are included in the unit tests.
|
98
|
-
|
99
|
-
### Server
|
100
|
-
|
101
|
-
The performance is on the same magnitude as `bind9`. Some basic benchmarks resolving 1000 names concurrently, repeated 5 times, using `Async::DNS::Resolver` gives the following:
|
102
|
-
|
103
|
-
user system total real
|
104
|
-
Async::DNS::Server 4.280000 0.450000 4.730000 ( 4.854862)
|
105
|
-
Bind9 4.970000 0.520000 5.490000 ( 5.541213)
|
106
|
-
|
107
|
-
These benchmarks are included in the unit tests. To test bind9 performance, it must be installed and `which named` must return the executable.
|
108
|
-
|
109
|
-
### DNSSEC support
|
110
|
-
|
111
|
-
DNSSEC is currently not supported and is [unlikely to be supported in the future](http://sockpuppet.org/blog/2015/01/15/against-dnssec/). Feel free to submit a PR.
|
112
|
-
|
113
|
-
## Contributing
|
114
|
-
|
115
|
-
1. Fork it
|
116
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
117
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
118
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
119
|
-
5. Create new Pull Request
|
120
|
-
|
121
|
-
### Desired Features
|
122
|
-
|
123
|
-
* Support for more features of DNS such as zone transfer.
|
124
|
-
* Some kind of system level integration, e.g. registering a DNS server with the currently running system resolver.
|
125
|
-
|
126
|
-
## License
|
127
|
-
|
128
|
-
Released under the MIT license.
|
129
|
-
|
130
|
-
Copyright, 2015, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
131
|
-
|
132
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
133
|
-
of this software and associated documentation files (the "Software"), to deal
|
134
|
-
in the Software without restriction, including without limitation the rights
|
135
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
136
|
-
copies of the Software, and to permit persons to whom the Software is
|
137
|
-
furnished to do so, subject to the following conditions:
|
138
|
-
|
139
|
-
The above copyright notice and this permission notice shall be included in
|
140
|
-
all copies or substantial portions of the Software.
|
141
|
-
|
142
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
143
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
144
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
145
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
146
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
147
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
148
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:test)
|
5
|
-
|
6
|
-
task :default => :test
|
7
|
-
|
8
|
-
task :console do
|
9
|
-
require 'pry'
|
10
|
-
|
11
|
-
require_relative 'lib/async/dns'
|
12
|
-
|
13
|
-
Pry.start
|
14
|
-
end
|
15
|
-
|
16
|
-
task :server do
|
17
|
-
require_relative 'lib/async/dns'
|
18
|
-
|
19
|
-
class TestServer < Async::DNS::Server
|
20
|
-
def process(name, resource_class, transaction)
|
21
|
-
@resolver ||= Async::DNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])
|
22
|
-
|
23
|
-
transaction.passthrough!(@resolver)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
server = TestServer.new([[:udp, '127.0.0.1', 2346]])
|
28
|
-
|
29
|
-
Async::Reactor.run do
|
30
|
-
server.run
|
31
|
-
end
|
32
|
-
end
|
data/async-dns.gemspec
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/async/dns/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "async-dns"
|
6
|
-
spec.version = Async::DNS::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
spec.description = <<-EOF
|
10
|
-
Async::DNS provides a high-performance DNS client resolver and server
|
11
|
-
which can be easily integrated into other projects or used as a stand-alone
|
12
|
-
daemon.
|
13
|
-
EOF
|
14
|
-
spec.summary = "An easy to use DNS client resolver and server for Ruby."
|
15
|
-
spec.homepage = "https://github.com/async/async-dns"
|
16
|
-
spec.license = "MIT"
|
17
|
-
|
18
|
-
spec.files = `git ls-files`.split($/)
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
-
spec.require_paths = ["lib"]
|
22
|
-
|
23
|
-
spec.add_dependency("async-io", "~> 1.15")
|
24
|
-
|
25
|
-
spec.add_development_dependency "async-rspec", "~> 1.0"
|
26
|
-
spec.add_development_dependency "process-daemon", "~> 1.0"
|
27
|
-
|
28
|
-
spec.add_development_dependency "bundler"
|
29
|
-
spec.add_development_dependency "rspec", "~> 3.6"
|
30
|
-
spec.add_development_dependency "rake"
|
31
|
-
end
|
data/examples/cloudflare.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
gem 'async'
|
4
|
-
gem 'async-http'
|
5
|
-
gem 'trenni'
|
6
|
-
|
7
|
-
require 'async/reactor'
|
8
|
-
require 'async/http/client'
|
9
|
-
require 'async/http/url_endpoint'
|
10
|
-
|
11
|
-
require 'trenni/uri'
|
12
|
-
|
13
|
-
endpoint = Async::HTTP::URLEndpoint.parse("https://cloudflare-dns.com/dns-query")
|
14
|
-
client = Async::HTTP::Client.new(endpoint)
|
15
|
-
|
16
|
-
Async::Reactor.run do |task|
|
17
|
-
request_uri = Trenni::URI(endpoint.url.request_uri, ct: "application/dns-json", name: "microsoft.com", type: "MX")
|
18
|
-
|
19
|
-
puts "GET #{request_uri}"
|
20
|
-
response = client.get(request_uri.to_s, {})
|
21
|
-
|
22
|
-
puts "#{response.status} #{response.version} #{response.headers.inspect}"
|
23
|
-
puts response.read.inspect
|
24
|
-
end
|