Class Dnsruby::DNS
In: lib/Dnsruby/DNS.rb
Parent: Object

Dnsruby::DNS class

Resolv::DNS performs DNS queries.

class methods

methods

The searchlist and other Config info is applied to the domain name if appropriate. All the nameservers are tried (if there is no timely answer from the first).

This class uses Resolver to perform the queries.

Information taken from the following places :

Methods

Attributes

config  [R] 

Public Class methods

Creates a new DNS resolver

config_info can be:

  • nil:: Uses platform default (e.g. /etc/resolv.conf)
  • String:: Path to a file using /etc/resolv.conf‘s format
  • Hash:: Must contain :nameserver, :search and :ndots keys
     example :
    
      Dnsruby::DNS.new({:nameserver => ['210.251.121.21'],
                        :search => ['ruby-lang.org'],
                        :ndots => 1})
    

Creates a new DNS resolver. See Resolv::DNS.new for argument details.

Yields the created DNS resolver to the block, if given, otherwise returns it.

Public Instance methods

Closes the resolver

Iterates over all IP addresses of name retrieved from the DNS resolver

name can be a Dnsruby::Name or a String. Retrieved address will be a Dnsruby::IPv4 or a Dnsruby::IPv6

Iterates over all hostnames for address retrieved from the DNS resolver

address must be a Dnsruby::IPv4, Dnsruby::IPv6 or a String. Retrieved name will be a Dnsruby::Name.

Iterates over all type, klass resources for name

type defaults to Dnsruby::Types.A klass defaults to Dnsruby::Classes.IN

Yielded resource is represented as a Dnsruby::RR instance, e.g. Dnsruby::RR::IN::A

Gets the first IP address of name from the DNS resolver

name can be a Dnsruby::Name or a String. Retrieved address will be a Dnsruby::IPv4 or a Dnsruby::IPv6

Gets all IP addresses of name from the DNS resolver

name can be a Dnsruby::Name or a String. Retrieved address will be a Dnsruby::IPv4 or a Dnsruby::IPv6

Gets the first hostname for address from the DNS resolver

address must be a Dnsruby::IPv4, Dnsruby::IPv6 or a String. Retrieved name will be a Dnsruby::Name.

Gets all hostnames for address from the DNS resolver

address must be a Dnsruby::IPv4, Dnsruby::IPv6 or a String. Retrieved name will be a Dnsruby::Name.

Look up the first type, klass resource for name

type defaults to Dnsruby::Types.A klass defaults to Dnsruby::Classes.IN

Returned resource is represented as a Dnsruby::RR instance, e.g. Dnsruby::RR::IN::A

Look up all type, klass resources for name

type defaults to Dnsruby::Types.A klass defaults to Dnsruby::Classes.IN

Returned resource is represented as a Dnsruby::RR instance, e.g. Dnsruby::RR::IN::A

[Validate]