Skip to content

Instantly share code, notes, and snippets.

@moondev
Created July 12, 2024 13:26
Show Gist options
  • Save moondev/d482d3ed1cb6c5a5fb6ebaeadbeaeaea to your computer and use it in GitHub Desktop.
Save moondev/d482d3ed1cb6c5a5fb6ebaeadbeaeaea to your computer and use it in GitHub Desktop.
corefile
. {
forward . 8.8.8.8
# ip-a-b-c-d.example A a.b.c.d
template IN A lb.run {
match (.*)-(?P<a>[0-9]*)-(?P<b>[0-9]*)-(?P<c>[0-9]*)-(?P<d>[0-9]*)[.]ip[.]lb[.]run[.]$
answer "{{ .Name }} 60 IN A {{ .Group.a }}.{{ .Group.b }}.{{ .Group.c }}.{{ .Group.d }}"
fallthrough
}
# d.c.b.a.in-addr.arpa PTR ip-a-b-c-d.example
template IN PTR in-addr.arpa {
match (.*)-(?P<d>[0-9]*)[.](?P<c>[0-9]*)[.](?P<b>[0-9]*)[.](?P<a>[0-9]*)[.]in-addr[.]arpa[.]$
answer "{{ .Name }} 60 IN PTR {{ .Group.a }}-{{ .Group.b }}-{{ .Group.c }}-{{ .Group.d }}.ip.lb.run."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment