Method: Dnsruby::Resolver#initialize
- Defined in:
- lib/dnsruby/resolver.rb
#initialize(*args) ⇒ Resolver
Create a new Resolver object. If no parameters are passed in, then the default
system configuration will be used. Otherwise, a Hash may be passed in with the
following optional elements :
* :port
* :use_tcp
* :tsig
* :ignore_truncation
* :src_address
* :src_address6
* :src_port
* :recurse
* :udp_size
* :config_info - see Config
* :nameserver - can be either a String or an array of Strings
* :packet_timeout
* :query_timeout
* :retry_times
* :retry_delay
* :do_caching
* :tcp_pipelining
* :tcp_pipelining_max_queries - can be a number or :infinite symbol
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/dnsruby/resolver.rb', line 436 def initialize(*args) # @TODO@ Should we allow :namesver to be an RRSet of NS records? Would then need to randomly order them? @resolver_ruby = nil @src_address = nil @src_address6 = nil @single_res_mutex = Mutex.new @configured = false @do_caching = true @config = Config.new() reset_attributes # Process args if args.length == 1 if args[0].class == Hash args[0].keys.each do |key| begin if key == :config_info @config.set_config_info(args[0][:config_info]) elsif key == :nameserver set_config_nameserver(args[0][:nameserver]) elsif key == :nameservers set_config_nameserver(args[0][:nameservers]) else send(key.to_s + '=', args[0][key]) end rescue Exception => e Dnsruby.log.error{"Argument #{key} not valid : #{e}\n"} end end elsif args[0].class == String set_config_nameserver(args[0]) elsif args[0].class == Config # also accepts a Config object from Dnsruby::Resolv @config = args[0] end else # Anything to do? end update end |