Commit 5d7327a3 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

host.resolve: use drill

parent 768953af
......@@ -29,18 +29,14 @@ function M.resolve(host, context)
if not dnscache[host] then
dnscache[host] = {}
for rec in io.popen('dig '' A '' AAAA'):lines() do
local name, rtype, addr =
for family, rtype in pairs{inet='A', inet6='AAAA'} do
for rec in io.popen('drill '' '..rtype):lines() do
local name, addr = rec:match(
if name and name:sub(1, host:len() + 1) == host..'.' then
if rtype == 'A' then family = 'inet'
elseif rtype == 'AAAA' then family = 'inet6'
else family = nil end
if family then
assert(getfamily(addr, context) == family)
table.insert(dnscache[host], {family, addr})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment