Module: Dnsruby

### Home Classes Methods

### In Files

- lib/Dnsruby/Cache.rb
- lib/Dnsruby/code_mapper.rb
- lib/Dnsruby/Config.rb
- lib/Dnsruby/DNS.rb
- lib/Dnsruby/dnssec.rb
- lib/Dnsruby/Hosts.rb
- lib/Dnsruby/ipv4.rb
- lib/Dnsruby/ipv6.rb
- lib/Dnsruby/key_cache.rb
- lib/Dnsruby/message.rb
- lib/Dnsruby/name.rb
- lib/Dnsruby/PacketSender.rb
- lib/Dnsruby/Recursor.rb
- lib/Dnsruby/Resolver.rb
- lib/Dnsruby/resource/A.rb
- lib/Dnsruby/resource/AAAA.rb
- lib/Dnsruby/resource/AFSDB.rb
- lib/Dnsruby/resource/CERT.rb
- lib/Dnsruby/resource/DHCID.rb
- lib/Dnsruby/resource/DLV.rb
- lib/Dnsruby/resource/DNSKEY.rb
- lib/Dnsruby/resource/domain_name.rb
- lib/Dnsruby/resource/DS.rb
- lib/Dnsruby/resource/generic.rb
- lib/Dnsruby/resource/HINFO.rb
- lib/Dnsruby/resource/HIP.rb
- lib/Dnsruby/resource/IN.rb
- lib/Dnsruby/resource/IPSECKEY.rb
- lib/Dnsruby/resource/ISDN.rb
- lib/Dnsruby/resource/KX.rb
- lib/Dnsruby/resource/LOC.rb
- lib/Dnsruby/resource/MINFO.rb
- lib/Dnsruby/resource/MX.rb
- lib/Dnsruby/resource/NAPTR.rb
- lib/Dnsruby/resource/NSAP.rb
- lib/Dnsruby/resource/NSEC.rb
- lib/Dnsruby/resource/NSEC3.rb
- lib/Dnsruby/resource/NSEC3PARAM.rb
- lib/Dnsruby/resource/OPT.rb
- lib/Dnsruby/resource/PX.rb
- lib/Dnsruby/resource/resource.rb
- lib/Dnsruby/resource/RP.rb
- lib/Dnsruby/resource/RRSIG.rb
- lib/Dnsruby/resource/RT.rb
- lib/Dnsruby/resource/SOA.rb
- lib/Dnsruby/resource/SPF.rb
- lib/Dnsruby/resource/SRV.rb
- lib/Dnsruby/resource/SSHFP.rb
- lib/Dnsruby/resource/TKEY.rb
- lib/Dnsruby/resource/TSIG.rb
- lib/Dnsruby/resource/TXT.rb
- lib/Dnsruby/resource/X25.rb
- lib/Dnsruby/select_thread.rb
- lib/Dnsruby/SingleResolver.rb
- lib/Dnsruby/TheLog.rb
- lib/Dnsruby/update.rb
- lib/Dnsruby/validator_thread.rb
- lib/Dnsruby/zone_reader.rb
- lib/Dnsruby/zone_transfer.rb
- lib/dnsruby.rb

### Namespace

- CLASS Dnsruby::Algorithms
- CLASS Dnsruby::Classes
- CLASS Dnsruby::CodeMapper
- CLASS Dnsruby::Config
- CLASS Dnsruby::DNS
- CLASS Dnsruby::DecodeError
- CLASS Dnsruby::Dnssec
- CLASS Dnsruby::EncodeError
- CLASS Dnsruby::ExtendedRCode
- CLASS Dnsruby::FormErr
- CLASS Dnsruby::Header
- CLASS Dnsruby::Hosts
- CLASS Dnsruby::IPv4
- CLASS Dnsruby::IPv6
- CLASS Dnsruby::Message
- CLASS Dnsruby::MetaTypes
- CLASS Dnsruby::Modes
- CLASS Dnsruby::NXDomain
- CLASS Dnsruby::NXRRSet
- CLASS Dnsruby::Name
- CLASS Dnsruby::NotAuth
- CLASS Dnsruby::NotImp
- CLASS Dnsruby::NotZone
- CLASS Dnsruby::Nsec3HashAlgorithms
- CLASS Dnsruby::OpCode
- CLASS Dnsruby::OtherResolvError
- CLASS Dnsruby::QTypes
- CLASS Dnsruby::Question
- CLASS Dnsruby::RCode
- CLASS Dnsruby::RR
- CLASS Dnsruby::RRSet
- CLASS Dnsruby::Recursor
- CLASS Dnsruby::Refused
- CLASS Dnsruby::Resolv
- CLASS Dnsruby::ResolvError
- CLASS Dnsruby::ResolvTimeout
- CLASS Dnsruby::Resolver
- CLASS Dnsruby::SelectThread
- CLASS Dnsruby::ServFail
- CLASS Dnsruby::SingleResolver
- CLASS Dnsruby::TheLog
- CLASS Dnsruby::TsigError
- CLASS Dnsruby::TsigNotSignedResponseError
- CLASS Dnsruby::Types
- CLASS Dnsruby::Update
- CLASS Dnsruby::VerifyError
- CLASS Dnsruby::YXDomain
- CLASS Dnsruby::YXRRSet
- CLASS Dnsruby::ZoneReader
- CLASS Dnsruby::ZoneSerialError
- CLASS Dnsruby::ZoneTransfer

### Methods

- ::log
- ::version

### Files

- DNSSEC
- EVENTMACHINE
- EXAMPLES
- README

### Class/Module Index

Quicksearch

- Dnsruby
- Dnsruby::Algorithms
- Dnsruby::Classes
- Dnsruby::CodeMapper
- Dnsruby::Config
- Dnsruby::DNS
- Dnsruby::DecodeError
- Dnsruby::Dnssec
- Dnsruby::Dnssec::ValidationPolicy
- Dnsruby::EncodeError
- Dnsruby::ExtendedRCode
- Dnsruby::FormErr
- Dnsruby::Header
- Dnsruby::Hosts
- Dnsruby::IPv4
- Dnsruby::IPv6
- Dnsruby::Message
- Dnsruby::Message::Section
- Dnsruby::Message::SecurityLevel
- Dnsruby::MetaTypes
- Dnsruby::Modes
- Dnsruby::NXDomain
- Dnsruby::NXRRSet
- Dnsruby::Name
- Dnsruby::Name::Label
- Dnsruby::NotAuth
- Dnsruby::NotImp
- Dnsruby::NotZone
- Dnsruby::Nsec3HashAlgorithms
- Dnsruby::OpCode
- Dnsruby::OtherResolvError
- Dnsruby::QTypes
- Dnsruby::Question
- Dnsruby::RCode
- Dnsruby::RR
- Dnsruby::RR::ANY
- Dnsruby::RR::CERT
- Dnsruby::RR::CERT::CertificateTypes
- Dnsruby::RR::CNAME
- Dnsruby::RR::DHCID
- Dnsruby::RR::DLV
- Dnsruby::RR::DNAME
- Dnsruby::RR::DNSKEY
- Dnsruby::RR::DS
- Dnsruby::RR::DS::DigestTypes
- Dnsruby::RR::DomainName
- Dnsruby::RR::Generic
- Dnsruby::RR::HINFO
- Dnsruby::RR::HIP
- Dnsruby::RR::IN
- Dnsruby::RR::IN::A
- Dnsruby::RR::IN::AAAA
- Dnsruby::RR::IN::AFSDB
- Dnsruby::RR::IN::PX
- Dnsruby::RR::IN::SRV
- Dnsruby::RR::IN::WKS
- Dnsruby::RR::IPSECKEY
- Dnsruby::RR::ISDN
- Dnsruby::RR::KX
- Dnsruby::RR::LOC
- Dnsruby::RR::MB
- Dnsruby::RR::MG
- Dnsruby::RR::MINFO
- Dnsruby::RR::MR
- Dnsruby::RR::MX
- Dnsruby::RR::NAPTR
- Dnsruby::RR::NS
- Dnsruby::RR::NSAP
- Dnsruby::RR::NSEC
- Dnsruby::RR::NSEC3
- Dnsruby::RR::NSEC3PARAM
- Dnsruby::RR::OPT
- Dnsruby::RR::PTR
- Dnsruby::RR::RP
- Dnsruby::RR::RRSIG
- Dnsruby::RR::RT
- Dnsruby::RR::SOA
- Dnsruby::RR::SPF
- Dnsruby::RR::SSHFP
- Dnsruby::RR::SSHFP::Algorithms
- Dnsruby::RR::SSHFP::FpTypes
- Dnsruby::RR::TKEY
- Dnsruby::RR::TSIG
- Dnsruby::RR::TXT
- Dnsruby::RR::X25
- Dnsruby::RRSet
- Dnsruby::Recursor
- Dnsruby::Refused
- Dnsruby::Resolv
- Dnsruby::ResolvError
- Dnsruby::ResolvTimeout
- Dnsruby::Resolver
- Dnsruby::Resolver::EventType
- Dnsruby::SelectThread
- Dnsruby::ServFail
- Dnsruby::SingleResolver
- Dnsruby::TheLog
- Dnsruby::TsigError
- Dnsruby::TsigNotSignedResponseError
- Dnsruby::Types
- Dnsruby::Update
- Dnsruby::VerifyError
- Dnsruby::YXDomain
- Dnsruby::YXRRSet
- Dnsruby::ZoneReader
- Dnsruby::ZoneReader::ParseException
- Dnsruby::ZoneSerialError
- Dnsruby::ZoneTransfer
- Dnsruby::ZoneTransfer::Delta
- Base32

No matching classes.

# Dnsruby

@TODO@ Max size for cache?

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.

# Dnsruby library

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.

## example

    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]}
    }

## exceptions

- ResolvError < StandardError

- ResolvTimeout < TimeoutError

- NXDomain < ResolvError

- FormErr < ResolvError

- ServFail < ResolvError

- NotImp < ResolvError

- Refused < ResolvError

- NotZone < ResolvError

- YXDomain < ResolvError

- YXRRSet < ResolvError

- NXRRSet < ResolvError

- NotAuth < ResolvError

- OtherResolvError < ResolvError

## I/O

Dnsruby implements a pure Ruby event loop to perform I/O. Support for EventMachine has been deprecated.

## DNSSEC

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.

## Bugs

- NIS is not supported.

- /etc/nsswitch.conf is not supported.

- NSEC3 validation still TBD

### Constants

VERSION

  @TODO@ Remember to update version in dnsruby.gemspec!

### Public Class Methods

log() click to toggle source

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

version() click to toggle source

    # File lib/dnsruby.rb, line 108
    def Dnsruby.version
      return VERSION
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.