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

Description

 The Config class determines the system configuration for DNS.
 In particular, it determines the nameserver to target queries to.

 It also specifies whether and how the search list and default
 domain should be applied to queries, according to the following
 algorithm :
  • If the name is absolute, then it is used as is.
  • If the name is not absolute, then :
       If apply_domain is true, and ndots is greater than the number
       of labels in the name, then the default domain is added to the name.
    
       If apply_search_list is true, then each member of the search list
       is appended to the name.
    
     The Config class has now been modified for lazy loading. Previously, the config
     was loaded when a Resolver was instantiated. Now, the config is only loaded if
     a query is performed (or a config parameter requested on) a Resolver which has
     not yet been configured.
    

Methods

Attributes

apply_domain  [RW]  Should the default domain be applied?
apply_search_list  [RW]  Should the search list be applied?

Public Class methods

Create a new Config with system default values

Reset the config to default values

Public Instance methods

Add a nameserver to the list of nameservers.

Can take either a single String or an array of Strings. The new nameservers are added at a higher priority.

Return the default domain

Set the default domain

The list of nameservers to query

Set the config to point to a single nameserver

The minimum number of labels in the query name (if it is not absolute) before it is considered complete

Return the search path

Set the default search path

Set the config. Parameter can be :

  • A String containing the name of the config file to load
         e.g. /etc/resolv.conf
    
  • A hash with the following elements :
         nameserver (String)
         domain (String)
         search (String)
         ndots (Fixnum)
    

This method should not normally be called by client code.

[Validate]