Changeset

4267:29d7eb6ff62c

net.dns: Support for resolving AAAA records
author Matthew Wild <mwild1@gmail.com>
date Mon, 16 May 2011 19:33:02 +0100
parents 4266:513485a11b85
children 4268:c249f10eb9bb
files net/dns.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Sat May 07 21:17:03 2011 +0500
+++ b/net/dns.lua	Mon May 16 19:33:02 2011 +0100
@@ -389,6 +389,14 @@
 	rr.a = string.format('%i.%i.%i.%i', b1, b2, b3, b4);
 end
 
+function resolver:AAAA(rr)
+	local addr = {};
+	for i = 1, rr.rdlength, 2 do
+		local b1, b2 = self:byte(2);
+		table.insert(addr, ("%02x%02x"):format(b1, b2));
+	end
+	rr.aaaa = table.concat(addr, ":");
+end
 
 function resolver:CNAME(rr)    -- - - - - - - - - - - - - - - - - - - -  CNAME
 	rr.cname = self:name();