diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-05-16 19:33:02 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-05-16 19:33:02 +0100 |
commit | dc7c12d028a40b72034a6b63d0c9e88c22631f5b (patch) | |
tree | 18d6c934aa1d5786b3138de464f4777b2ca4c64b | |
parent | b66c11930e82ff90be4677d67dbeded2a634db0d (diff) | |
download | prosody-dc7c12d028a40b72034a6b63d0c9e88c22631f5b.tar.gz prosody-dc7c12d028a40b72034a6b63d0c9e88c22631f5b.zip |
net.dns: Support for resolving AAAA records
-rw-r--r-- | net/dns.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/dns.lua b/net/dns.lua index 08cb0f7c..3f1cb4f6 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -389,6 +389,14 @@ function resolver:A(rr) -- - - - - - - - - - - - - - - - - - - - - - - - A 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(); |