Method: Resolv::DNS#initialize
- Defined in:
- lib/resolv.rb
#initialize(config_info = nil) ⇒ DNS
Creates a new DNS resolver.
config_info
can be:
- nil
-
Uses /etc/resolv.conf.
- String
-
Path to a file using /etc/resolv.conf’s format.
- Hash
-
Must contain :nameserver, :search and :ndots keys.
:nameserver_port can be used to specify port number of nameserver address.
The value of :nameserver should be an address string or an array of address strings.
-
:nameserver => ‘8.8.8.8’
-
:nameserver => [‘8.8.8.8’, ‘8.8.4.4’]
The value of :nameserver_port should be an array of pair of nameserver address and port number.
-
:nameserver_port => [[‘8.8.8.8’, 53], [‘8.8.4.4’, 53]]
Example:
Resolv::DNS.new(:nameserver => ['210.251.121.21'],
:search => ['ruby-lang.org'],
:ndots => 1)
329 330 331 332 333 |
# File 'lib/resolv.rb', line 329 def initialize(config_info=nil) @mutex = Thread::Mutex.new @config = Config.new(config_info) @initialized = nil end |