Class: Unbound::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/unbound/resolver.rb

Instance Method Summary collapse

Constructor Details

#initializeResolver

Returns a new instance of Resolver.



7
8
9
10
11
12
13
14
# File 'lib/unbound/resolver.rb', line 7

def initialize()
  @ctx = Unbound::Context.new
  @ctx.load_config("unbound/etc/unbound.conf")

  cb = Proc.new { |a,b,c| nil }
  self.query("localhost", 1, 1, cb) 
  @ctx.wait()
end

Instance Method Details

#cancel(async_id) ⇒ Object



28
29
30
# File 'lib/unbound/resolver.rb', line 28

def cancel(async_id)
  @ctx.cancel_async_query(async_id)
end

#closeObject



16
17
18
# File 'lib/unbound/resolver.rb', line 16

def close
  @ctx.close
end

#fdObject



20
21
22
# File 'lib/unbound/resolver.rb', line 20

def fd
  @ctx.fd
end

#processObject



24
25
26
# File 'lib/unbound/resolver.rb', line 24

def process
  @ctx.process
end

#query(name, rrtype, rrclass, callback, private_data = nil) ⇒ Object



32
33
34
# File 'lib/unbound/resolver.rb', line 32

def query(name, rrtype, rrclass, callback, private_data = nil)
  @ctx.resolve_async(name, rrtype, rrclass, callback, private_data)
end