Method: Async::DNS::Transaction#passthrough!

Defined in:
lib/async/dns/transaction.rb

#passthrough!(resolver, options = {}, &block) ⇒ Object

Use the given resolver to respond to the question. Uses ‘passthrough` to do the lookup and merges the result.

If a block is supplied, this function yields with the ‘response` message if successful. This could be used, for example, to update a cache or modify the reply.

If recursion is not requested, the result is ‘fail!(:Refused)`. This check is ignored if an explicit `options` or `options` is given.

If the resolver can’t reach upstream servers, ‘fail!(:ServFail)` is invoked.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/async/dns/transaction.rb', line 81

def passthrough!(resolver, options = {}, &block)
  if @query.rd || options[:force] || options[:name]
    response = passthrough(resolver, options)
    
    if response
      yield response if block_given?
      
      # Recursion is available and is being used:
      # See issue #26 for more details.
      @response.ra = 1
      @response.merge!(response)
    else
      fail!(:ServFail)
    end
  else
    fail!(:Refused)
  end
end