Last active
November 6, 2020 10:02
-
-
Save 42wim/e28709cc8548a36f34b7c090f1225a9e to your computer and use it in GitHub Desktop.
dnsdist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function maintenance() | |
res = blockingGetAddrInfo(newDNSName('mydns.service.consul')) | |
active = getPoolServers("apool") | |
local match = {} | |
local match2 = {} | |
for k,v in pairs(res) do | |
match[v:toString()]=false | |
end | |
for a,b in pairs(active) do | |
match2[a]=false | |
end | |
for a,b in pairs(active) do | |
for k,v in pairs(res) do | |
server = "[" .. v:toString() .. "]:53" | |
if server == b:getNameWithAddr() then | |
match[v:toString()]=true | |
end | |
end | |
end | |
for k,v in pairs(match) do | |
if v == false then | |
newServer({address=k,pool="apool"}) | |
end | |
end | |
for k,v in pairs(match2) do | |
if v == false then | |
rmServer(k-1) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment