EventMachine::Udns::Multi
Aggregate a large number of asynchronous DNS queries together using em-udns
.
Installation
Add this line to your application's Gemfile:
gem 'em-udns-multi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install em-udns-multi
Usage
The following example is trivial but can be expanded on significantly.
#!/usr/bin/env ruby
require 'eventmachine'
require 'em-udns'
require 'em-udns-multi'
EventMachine.run do
# Create an aggregate resolver that must complete within 250ms.
resolver = EventMachine::Udns::Multi.new(0.250)
resolver.callback do |results|
puts "[x] Got a response: #{results.inspect}"
EventMachine.stop
end
resolver.query(:google, 'google.com', 'A')
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request