em-udns 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,25 +2,9 @@ module EventMachine::Udns
2
2
 
3
3
  class Resolver
4
4
 
5
- def initialize(nameserver = nil)
5
+ def initialize
6
6
  raise UdnsError, @alloc_error if @alloc_error
7
-
8
7
  @queries = {}
9
-
10
- if nameserver
11
- ENV.delete("NAMESERVERS")
12
- ENV["NAMESERVERS"] = case nameserver
13
- # A single nameserver.
14
- when String
15
- nameserver
16
- # Multiple nameservers.
17
- when Array
18
- nameserver.join(" ")
19
- else
20
- raise Error, "`nameserver' argument must be a String or Array of addresses"
21
- end
22
- end
23
-
24
8
  dns_open
25
9
  end
26
10
 
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module Udns
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
data/lib/em-udns.rb CHANGED
@@ -17,6 +17,22 @@ module EventMachine::Udns
17
17
  end
18
18
  end
19
19
 
20
+ def self.nameservers=(nameservers)
21
+ if nameservers
22
+ ENV.delete("NAMESERVERS")
23
+ ENV["NAMESERVERS"] = case nameservers
24
+ # A single nameserver.
25
+ when String
26
+ nameservers
27
+ # Multiple nameservers.
28
+ when Array
29
+ nameservers.join(" ")
30
+ else
31
+ raise Error, "`nameservers' argument must be a String or Array of addresses"
32
+ end
33
+ end
34
+ end
35
+
20
36
  def self.run(resolver)
21
37
  raise Error, "EventMachine is not running" unless EM.reactor_running?
22
38
 
data/test/test-em-udns.rb CHANGED
@@ -54,8 +54,11 @@ end
54
54
 
55
55
  EM.set_max_timers 100000
56
56
  EM.run do
57
+
58
+ # Set the nameserver rather than using /etc/resolv.conf.
59
+ #EM::Udns.nameservers = "127.0.0.1"
57
60
 
58
- resolver = EM::Udns::Resolver.new "127.0.0.1"
61
+ resolver = EM::Udns::Resolver.new
59
62
  EM::Udns.run resolver
60
63
 
61
64
  second = 0
metadata CHANGED
@@ -1,38 +1,44 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: em-udns
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.5
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 6
9
+ version: 0.1.6
6
10
  platform: ruby
7
- authors:
8
- - Iñaki Baz Castillo
11
+ authors:
12
+ - "I\xC3\xB1aki Baz Castillo"
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2011-02-28 00:00:00.000000000 +01:00
16
+
17
+ date: 2011-04-14 00:00:00 +02:00
13
18
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
16
21
  name: eventmachine
17
- requirement: &18014240 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
18
24
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
23
31
  type: :runtime
24
- prerelease: false
25
- version_requirements: *18014240
26
- description: em-udns is an async DNS resolver for EventMachine based on udns C library.
27
- Having most of the core written in C, em-udns becomes very fast. It can resolve
28
- DNS A, AAAA, PTR, MX, TXT, SRV and NAPTR records, and can handle every kind of errors
29
- (domain/record not found, request timeout, malformed response...).
32
+ version_requirements: *id001
33
+ description: em-udns is an async DNS resolver for EventMachine based on udns C library. Having most of the core written in C, em-udns becomes very fast. It can resolve DNS A, AAAA, PTR, MX, TXT, SRV and NAPTR records, and can handle every kind of errors (domain/record not found, request timeout, malformed response...).
30
34
  email: ibc@aliax.net
31
35
  executables: []
32
- extensions:
36
+
37
+ extensions:
33
38
  - ext/extconf.rb
34
39
  extra_rdoc_files: []
35
- files:
40
+
41
+ files:
36
42
  - lib/em-udns.rb
37
43
  - lib/em-udns/version.rb
38
44
  - lib/em-udns/resolver.rb
@@ -44,26 +50,36 @@ files:
44
50
  has_rdoc: true
45
51
  homepage: https://github.com/ibc/em-udns
46
52
  licenses: []
53
+
47
54
  post_install_message:
48
55
  rdoc_options: []
49
- require_paths:
56
+
57
+ require_paths:
50
58
  - lib
51
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
52
60
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 1
66
+ - 8
67
+ - 7
56
68
  version: 1.8.7
57
- required_rubygems_version: !ruby/object:Gem::Requirement
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
70
  none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ version: "0"
63
77
  requirements: []
78
+
64
79
  rubyforge_project:
65
- rubygems_version: 1.5.3
80
+ rubygems_version: 1.3.7
66
81
  signing_key:
67
82
  specification_version: 3
68
83
  summary: Async DNS resolver for EventMachine based on udns C library
69
84
  test_files: []
85
+