Class Rev::DNSResolver
In: lib/rev/dns_resolver.rb
Parent: IOWatcher

A non-blocking DNS resolver. It provides interfaces for querying both /etc/hosts and nameserves listed in /etc/resolv.conf, or nameservers of your choosing.

Presently the client only supports UDP requests against your nameservers and cannot resolve anything with records larger than 512-bytes. Also, IPv6 is not presently supported.

DNSResolver objects are one-shot. Once they resolve a domain name they automatically detach themselves from the event loop and cannot be used again.

Methods

Classes and Modules

Class Rev::DNSResolver::Timeout

Constants

RESOLV_CONF = '/etc/resolv.conf'
HOSTS = '/etc/hosts'
DNS_PORT = 53
DATAGRAM_SIZE = 512
TIMEOUT = 3
RETRIES = 4

Public Class methods

Query /etc/hosts (or the specified hostfile) for the given host

Create a new Rev::Watcher descended object to resolve the given hostname. If you so desire you can also specify a list of nameservers to query. By default the resolver will use nameservers listed in /etc/resolv.conf

Public Instance methods

Attach the DNSResolver to the given event loop

Detach the DNSResolver from the given event loop

Called when we receive a response indicating the name didn‘t resolve

Called when the name has successfully resolved to an address

on_timeout()

Alias for on_failure

Protected Instance methods

Called by the subclass when the DNS response is available

Send a request to the DNS server

[Validate]