Dnsruby is a thread-aware DNS stub resolver library written in Ruby.
It is based on resolv.rb, the standard Ruby DNS implementation, but gives a complete DNS implementation, including DNSSEC.
The Resolv class can be used to resolve addresses using /etc/hosts and /etc/resolv.conf, or the DNS class can be used to make DNS queries. These interfaces will attempt to apply the default domain and searchlist when resolving names.
The Resolver and SingleResolver interfaces allow finer control of individual messages. The Resolver class sends queries to multiple resolvers using various retry mechanisms. The SingleResolver class is used by Resolver to send individual Messages to individual resolvers.
Resolver queries return Dnsruby::Message objects. Message objects have five sections:
The header section, a Dnsruby::Header object.
The question section, a list of Dnsruby::Question objects.
The answer section, a list of Dnsruby::Resource objects.
The authority section, a list of Dnsruby::Resource objects.
The additional section, a list of Dnsruby::Resource objects.
res = Dnsruby::Resolver.new # System default ret = res.query("example.com") print "#{ret.anwer.length} answer records returned, #{ret.answer.rrsets.length} RRSets returned in aswer section\n" p Dnsruby::Resolv.getaddress("www.ruby-lang.org") p Dnsruby::Resolv.getname("210.251.121.214") Dnsruby::DNS.open {|dns| p dns.getresources("www.ruby-lang.org", Dnsruby::Types.A).collect {|r| r.address} p dns.getresources("ruby-lang.org", 'MX').collect {|r| [r.exchange.to_s, r.preference]} }
ResolvError < StandardError
ResolvTimeout < TimeoutError
Dnsruby implements a pure Ruby event loop to perform I/O. Support for EventMachine has been deprecated.
Dnsruby supports DNSSEC and NSEC(3). DNSSEC support is on by default - but no trust anchors are configured by default. See Dnsruby::Dnssec for more details.
NIS is not supported.
/etc/nsswitch.conf is not supported.
NSEC3 validation still TBD
This class does verification/validation from a single point - signed root, DLV, trust anchors. Dnssec controls a set of these to perform validation for the client. This class should only be used by Dnsruby
require 'Dnsruby/iana_ports'
This class provides the facility to load a zone file. It can either process one line at a time, or return an entire zone as a list of records.
@TODO@ Max size for cache?
@TODO@ Remember to update version in dnsruby.gemspec!
Get the log for Dnsruby Use this to set the log level e.g. Dnsruby.log.level = Logger::INFO
# File lib/dnsruby.rb, line 117 def Dnsruby.log @@logger end
Generated with the Darkfish Rdoc Generator 2.