dns/utils/common.js
Simon Marsh de3677baa5
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
initial zones
2020-09-22 19:48:09 +01:00

55 lines
1.4 KiB
JavaScript

//////////////////////////////////////////////////////////////////////////
// !!!!!!!!!!!!
// most functions here assume the 'domain' variable is set
// !!!!!!!!!!!!
//////////////////////////////////////////////////////////////////////////
function proxied(name)
{
D_EXTEND(
domain,
CNAME(name, 'rproxy.burble.dn42.')
);
}
//////////////////////////////////////////////////////////////////////////
function fqdn(name)
{
if (name === '@') {
return domain+'.';
}
return name+"."+domain+'.';
}
//////////////////////////////////////////////////////////////////////////
// add a service including reverse DNS
function service(name, ipv6, ipv4)
{
if (typeof ipv6 !== 'undefined') {
D_EXTEND(domain, AAAA(name, ipv6));
D_EXTEND(rz_6, PTR(ipv6, fqdn(name)));
}
if (typeof ipv4 !== 'undefined') {
D_EXTEND(domain, A(name, ipv4));
D_EXTEND(rz_s4, PTR(ipv4, fqdn(name)));
}
}
// add a host, including reverse DNS
function host(name, ipv6, ipv4)
{
if (typeof ipv6 !== 'undefined') {
D_EXTEND(domain, AAAA(name, ipv6));
D_EXTEND(rz_6, PTR(ipv6, fqdn(name)));
}
if (typeof ipv4 !== 'undefined') {
D_EXTEND(domain, A(name, ipv4));
D_EXTEND(rz_n4, PTR(ipv4, fqdn(name)));
}
}
//////////////////////////////////////////////////////////////////////////
// end of file