aboutsummaryrefslogtreecommitdiffstats
path: root/net/dns.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-10 17:56:38 +0200
committerKim Alvefur <zash@zash.se>2018-06-10 17:56:38 +0200
commitae35950f7cd081ace7f6b3751e121888daf8a3d6 (patch)
tree73727eb5ec93c048019ee773d3ea0ddc9404b9e7 /net/dns.lua
parent0c7f971a484cc7b93d599ea8f0d8878a04fa994f (diff)
parent054cdafd57234e9b22cf6178552df1d1929b86ad (diff)
downloadprosody-ae35950f7cd081ace7f6b3751e121888daf8a3d6.tar.gz
prosody-ae35950f7cd081ace7f6b3751e121888daf8a3d6.zip
Merge 0.10->trunk
Diffstat (limited to 'net/dns.lua')
-rw-r--r--net/dns.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/dns.lua b/net/dns.lua
index e015bca8..af5f1216 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -90,12 +90,20 @@ end
local function augment (t, prefix) -- - - - - - - - - - - - - - - - - augment
local a = {};
- for i = 1, 0xffff do
- local s = t[i] or ("%s%d"):format(prefix, i);
+ for i,s in pairs(t) do
a[i] = s;
a[s] = s;
a[string.lower(s)] = s;
end
+ setmetatable(a, {
+ __index = function (_, i)
+ if type(i) == "number" then
+ return ("%s%d"):format(prefix, i);
+ elseif type(i) == "string" then
+ return i:upper();
+ end
+ end;
+ })
return a;
end