Comparison

net/dns.lua @ 4267:29d7eb6ff62c

net.dns: Support for resolving AAAA records
author Matthew Wild <mwild1@gmail.com>
date Mon, 16 May 2011 19:33:02 +0100
parent 4251:96e9d5f9ab3b
child 4373:9a20acf315c9
comparison
equal deleted inserted replaced
4266:513485a11b85 4267:29d7eb6ff62c
387 function resolver:A(rr) -- - - - - - - - - - - - - - - - - - - - - - - - A 387 function resolver:A(rr) -- - - - - - - - - - - - - - - - - - - - - - - - A
388 local b1, b2, b3, b4 = self:byte(4); 388 local b1, b2, b3, b4 = self:byte(4);
389 rr.a = string.format('%i.%i.%i.%i', b1, b2, b3, b4); 389 rr.a = string.format('%i.%i.%i.%i', b1, b2, b3, b4);
390 end 390 end
391 391
392 function resolver:AAAA(rr)
393 local addr = {};
394 for i = 1, rr.rdlength, 2 do
395 local b1, b2 = self:byte(2);
396 table.insert(addr, ("%02x%02x"):format(b1, b2));
397 end
398 rr.aaaa = table.concat(addr, ":");
399 end
392 400
393 function resolver:CNAME(rr) -- - - - - - - - - - - - - - - - - - - - CNAME 401 function resolver:CNAME(rr) -- - - - - - - - - - - - - - - - - - - - CNAME
394 rr.cname = self:name(); 402 rr.cname = self:name();
395 end 403 end
396 404