Something went wrong. Try again.
A basic dynamic DNS program with a Lua based configuration
Something went wrong. Try again.
Go 92%
Lua 5%
3%
README.md
dynamic-dns #
"What I cannot create, I do not understand" – Richard Feynman
I do not have affordable access to a static IPv4 address in my area. Like many others I need a way to keep my DNS records updated to my IP. However, most of these programs do not follow my philosophy of building many small useful tools as a way of understanding more of the problem space.
dynamic-dns is my way of learning and building a dynamic DNS system. It uses
lua for its configuration to allow for user defined behavior and for a more
pleasurable configuration experience (i use neovim btw).
Sample configuration #
-- config.lua
local http = require("http")
local json = require("json")
-- Domains to monitor / update
dns.cloudflare["CF_TOKEN_CONTENTS"] = {
"example.com",
}
dns.porkbun[{"PORKBUN_KEY", "PORKBUN_SECRET"}] = {
"not-example.com",
}
function check_aws()
local resp, status = http.get("https://checkip.amazonaws.com/", {})
return resp, status
end
-- Define how to check IPv4 Address
dns.get_ipv4 = function()
local ip, status = check_aws()
if status == 200 then
return ip
end
return ""
end
-- Interval to update the DNS records
dns.interval = 2 * time.duration.hour
-- Enables RPC api to allow for manual refreshes
dns.api = true
Available Lua Libraries: #
| Library | Source | Loading |
|---|---|---|
dns |
dynamic-dns | global |
time |
dynamic-dns | global |
http |
dynamic-dns | require |
os |
dynamic-dns | require |
json |
dynamic-dns | require |
math |
gopher-lua | require |
string |
gopher-lua | require |
table |
gopher-lua | require |
package |
gopher-lua | require |