class Dnsruby::Resolver

Description

Dnsruby::Resolver is a DNS stub resolver. This class performs queries with retries across multiple nameservers. The system configured resolvers are used by default.

The retry policy is a combination of the Net::DNS and dnsjava approach, and has the option of :

complete, but in which the total time per query round is split between the number of nameservers
targetted for the first round. and total time for query round is doubled for each query round

Note that, if a total timeout is specified, then that will apply regardless of the retry policy (i.e. it may cut retries short).

Note also that these timeouts are distinct from the SingleResolver’s packet_timeout

Timeouts apply to the initial query and response. If DNSSEC validation is to be performed, then additional queries may be required (these are performed automatically by Dnsruby). Each additional query will be performed with its own timeouts. So, even with a query_timeout of 5 seconds, a response which required extensive validation may take several times that long. (Future versions of Dnsruby may expose finer-grained events for client tracking of responses and validation)

Methods

Synchronous

These methods raise an exception or return a response message with rcode==NOERROR

There are "!" versions of these two methods that return an array [response, error]
instead of raising an error on failure.  They can be called as follows:

response, error = resolver.send_message!(...)
response, error = resolver.query!(...)

If the request succeeds, response will contain the Dnsruby::Message response
and error will be nil.

If the request fails, response will be nil and error will contain the error raised.

Asynchronous

These methods use a response queue to return the response and the error

Event Loop

Dnsruby runs a pure Ruby event loop to handle I/O in a single thread. Support for EventMachine has been deprecated.