aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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