Class: Auger::Dns

Inherits:
Connection show all
Defined in:
lib/auger/plugin/dns.rb

Instance Attribute Summary

Attributes inherited from Connection

#connection, #gateway, #options, #requests, #response, #roles

Instance Method Summary collapse

Methods inherited from Connection

#initialize, load, #method_missing, #timeout, #try_close, #try_open, #try_open_direct, #try_open_tunnel

Constructor Details

This class inherits a constructor from Auger::Connection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Auger::Connection

Instance Method Details

#close(dns) ⇒ Object



21
22
23
# File 'lib/auger/plugin/dns.rb', line 21

def close(dns)
  dns = nil
end

#domain(&block) ⇒ Object



25
26
27
# File 'lib/auger/plugin/dns.rb', line 25

def domain(&block)
  @requests << DnsDomainRequest.load(nil, &block)
end

#open(host, options) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/auger/plugin/dns.rb', line 12

def open(host, options)
  options[:nameserver] = host
  ## resolver checks args and raises error if no matching method, so only pass valid options
  safe_options = options.select{ |key| Net::DNS::Resolver.method_defined? key }
  dns = Net::DNS::Resolver.new(safe_options)
  dns.use_tcp = true if options[:use_tcp]
  dns
end

#query(name, &block) ⇒ Object



29
30
31
# File 'lib/auger/plugin/dns.rb', line 29

def query(name, &block)
  @requests << DnsQueryRequest.load(name, &block)
end