Skip to content

Instantly share code, notes, and snippets.

@st3fan
Created July 19, 2025 16:54
Show Gist options
  • Save st3fan/ae6b0a56b222bc2a1eb6f10680b1e261 to your computer and use it in GitHub Desktop.
Save st3fan/ae6b0a56b222bc2a1eb6f10680b1e261 to your computer and use it in GitHub Desktop.
-- Define backend pools
newServer{address="tls://8.8.8.8", pool="google", tlsHostname="dns.google"}
newServer{address="tls://8.8.4.4", pool="google", tlsHostname="dns.google"}
newServer{address="tls://1.1.1.1", pool="cloudflare", tlsHostname="cloudflare-dns.com"}
newServer{address="tls://1.0.0.1", pool="cloudflare", tlsHostname="cloudflare-dns.com"}
-- Define local listeners
addLocal("127.0.0.1:5301", {pool="google"})
addLocal("127.0.0.1:5302", {pool="cloudflare"})
addLocal("0.0.0.0:53") -- Main listener
-- Main listener will round-robin to both upstream pools via custom routing
function mainRouter(dq)
-- Round-robin or custom logic
if math.random() < 0.5 then
dq:setPool("google")
else
dq:setPool("cloudflare")
end
return DNSAction.None
end
setServerPolicy("leastOutstanding") -- or "firstAvailable", "roundrobin", etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment