From 2636c90a5ed7b970469dd31a9be68a683219d79b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 22 Jun 2024 17:07:31 +0200 Subject: Initial commit --- .envrc | 9 + .gitattributes | 1 + .gitignore | 2 + add_https.sh | 34 + creds.json | 15 + deploy | 3 + dnsconfig.js | 195 +++ prettier.config.mjs | 13 + shell.nix | 8 + types-dnscontrol.d.ts | 3219 +++++++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 3499 insertions(+) create mode 100644 .envrc create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100755 add_https.sh create mode 100644 creds.json create mode 100755 deploy create mode 100644 dnsconfig.js create mode 100644 prettier.config.mjs create mode 100644 shell.nix create mode 100644 types-dnscontrol.d.ts diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..82b2b9e --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# the shebang is ignored, but nice for editors + +if type -P lorri &>/dev/null; then + eval "$(lorri direnv)" +else + echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]' + use nix +fi diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d196b2f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +types-dnscontrol.d.ts binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..94c74ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/.env diff --git a/add_https.sh b/add_https.sh new file mode 100755 index 0000000..0664796 --- /dev/null +++ b/add_https.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +for dom in alanpearce.{eu,uk} aln.pe; do + xh PATCH $POWERDNS_API_URL/api/v1/servers/localhost/zones/${dom}. \ + X-API-KEY:$POWERDNS_API_KEY < + +// Helpers + +/** + * @param {object} record + * @param {string[]} [record.alpn] + * @param {string[]} [record.ipv4hint] + * @param {string[]} [record.ipv6hint] + */ +function https(record) { + return Object.keys(record) + .map(function (key) { + return [key, record[key].join(',')].join('=') + }) + .join(' ') +} + +// Fast, but no IPv6 support in 2024 +var vercelIPv4A = '76.76.21.241' +var vercelIPv4B = '76.76.21.98' + +// A bit slower but at least IPv6 is supported +var netlifyIPv4A = '75.2.60.5' +var netlifyIPv4B = '99.83.231.61' +var netlifyIPv6A = '2a05:d014:275:cb01::c8' +var netlifyIPv6B = '2a05:d014:275:cb00::c8' + +/** + * @param {string} name + */ +function vercelv4Netlifyv6(name) { + return [ + A(name, vercelIPv4A), + A(name, vercelIPv4B), + AAAA(name, netlifyIPv6A), + AAAA(name, netlifyIPv6B), + // neither vercel nor netlify support HTTP/3 yet + HTTPS(name, 1, '.', https({ alpn: ['h2'] })), + ] +} + +/** + * @param {string} domain + * @param {string} verification + */ +function iCloudMail(domain, verification) { + return [ + MX('@', 10, 'mx01.mail.icloud.com.'), + MX('@', 10, 'mx02.mail.icloud.com.'), + TXT('@', 'apple-domain=' + verification), + SPF_BUILDER({ + parts: ['v=spf1', 'redirect=icloud.com'], + }), + CNAME('sig1._domainkey', 'sig1.dkim.' + domain + '.at.icloudmailadmin.com.'), + ] +} + +/** + * @param {string[]} sources + * @param {string} target + */ +function bulkCNAME(sources, target) { + return sources.map(function (source) { + return CNAME(source, target) + }) +} + +var nameserversHE = [ + NAMESERVER('ns1.he.net.'), + NAMESERVER('ns2.he.net.'), + NAMESERVER('ns3.he.net.'), + NAMESERVER('ns4.he.net.'), + NAMESERVER('ns5.he.net.'), +] + +var acmeLetsEncrypt = [ + CAA_BUILDER({ + iodef: 'mailto:alan@alanpearce.eu', + issue: ['letsencrypt.org'], + issuewild: ['letsencrypt.org'], + }), + IGNORE('_acme-challenge', 'TXT'), + IGNORE('_acme-challenge.**', 'TXT'), +] + +var websiteHosting = [vercelv4Netlifyv6('@'), vercelv4Netlifyv6('www')] + +// Providers: + +var RegistrarNone = NewRegistrar('none') +var RegistrarOVH = NewRegistrar('ovh') +var PowerDNS = NewDnsProvider('powerdns') + +// Domains: + +DEFAULTS(DefaultTTL('1d'), NAMESERVER_TTL('1d')) + +D( + 'alanpearce.eu', + RegistrarOVH, + DnsProvider(PowerDNS), + + nameserversHE, + + acmeLetsEncrypt, + websiteHosting, + + // prettier-ignore + bulkCNAME([ + 'binarycache', + 'ci', + 'dns', + 'files', + 'git', + 'id', + 'legit', + 'ntfy', + 'pdns', + 'test', + ], 'linde'), + + // bluesky + TXT('_atproto', 'did=did:plc:exkgyiknwmakcrbmebvk34do'), + + CNAME('searchix', 'searchix.vercel.app.'), + CNAME('zola-bearblog', 'zola-bearblog.netlify.app.'), + + CNAME('home', 'nanopi'), + IGNORE('nanopi', 'A,AAAA'), + SSHFP('nanopi', 4, 2, '87383955296887ec069cfd2b41b556614918c2347306c5ef526f5306ad3e2dc7'), + SSHFP('nanopi', 4, 1, '9401664debcab758c9450ac65070f7cd0be6de64'), + SSHFP('nanopi', 3, 2, '5216e600a267675b4615c8a595323c455e8db8007d3bf01cd408166941019e38'), + SSHFP('nanopi', 3, 1, '09f0ec4751014d32c32c7d67c1127be3306a1baf'), + SSHFP('nanopi', 1, 2, 'ed6e750de7f6ddaa338f73c4140f0bd0d54711706986925bb8890a96abea1bc6'), + SSHFP('nanopi', 1, 1, '90bee798b3a7fe8aeb7e84ee7717b04edb0b197d'), + + A('linde', '116.203.248.56'), + AAAA('linde', '2a01:4f8:c012:23a4::1'), + HTTPS('linde', 1, '.', 'alpn=h3,h2'), + SSHFP('linde', 1, 1, 'ef6691558281a88b874ac41cf7c14d31209e64bc'), + SSHFP('linde', 1, 2, '5d1b6ecff5dd5c624ee662eb1684c3c9e42f9a138aa938ba8d018fbc5cf628de'), + SSHFP('linde', 4, 1, 'ec773b94dec19f70cb6df7c78df0229a6fbe9666'), + SSHFP('linde', 4, 2, '72f576b32b5c2d16312574182b028671fa39c8bab03d802fae04eb7f649d2570'), + CNAME('*.linde', 'linde'), + + iCloudMail('alanpearce.eu', 'anzQe301nq7grixH'), + DMARC_BUILDER({ + policy: 'reject', + percent: 100, + subdomainPolicy: 'reject', + rua: ['mailto:re+xkh82ketimo@dmarc.postmarkapp.com'], + alignmentSPF: 'r', + }) +) + +D( + 'alanpearce.uk', + RegistrarOVH, + DnsProvider(PowerDNS), + + acmeLetsEncrypt, + websiteHosting, + + iCloudMail('alanpearce.uk', 'BNdyqalwDX8kwF6k'), + DMARC_BUILDER({ + policy: 'reject', + percent: 100, + subdomainPolicy: 'reject', + rua: ['mailto:re+kef20qlkynz@dmarc.postmarkapp.com'], + alignmentSPF: 'r', + }), + + nameserversHE +) + +D( + 'aln.pe', + RegistrarNone, + DnsProvider(PowerDNS), + DefaultTTL(86400), + NAMESERVER_TTL(86400), + + acmeLetsEncrypt, + websiteHosting, + + SPF_BUILDER({ + parts: ['v=spf1', '-all'], + }), + + DNAME('@', 'alanpearce.eu.'), + + nameserversHE +) diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..de4d2a0 --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,13 @@ +/** + * @see https://prettier.io/docs/en/configuration.html + * @type {import("prettier").Config} + */ +const config = { + trailingComma: 'es5', + printWidth: 100, + tabWidth: 2, + semi: false, + singleQuote: true, +} + +export default config diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..4cf1d9a --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +{ pkgs ? (import { }) }: +pkgs.mkShell { + packages = with pkgs; [ + dnscontrol + xh + nodePackages.prettier + ]; +} diff --git a/types-dnscontrol.d.ts b/types-dnscontrol.d.ts new file mode 100644 index 0000000..3994b80 --- /dev/null +++ b/types-dnscontrol.d.ts @@ -0,0 +1,3219 @@ +// This file was automatically generated by DNSControl. Do not edit it directly. +// To update it, run `dnscontrol write-types`. + +// DNSControl version 4.10.0 +// WARNING: These type definitions are experimental and subject to change in future releases. + +interface Domain { + name: string; + subdomain: string; + registrar: unknown; + meta: Record; + records: DNSRecord[]; + dnsProviders: Record; + defaultTTL: number; + nameservers: unknown[]; + ignored_names: unknown[]; + ignored_targets: unknown[]; + [key: string]: unknown; +} + +interface DNSRecord { + type: string; + meta: Record; + ttl: number; +} + +type DomainModifier = + | ((domain: Domain) => void) + | Partial + | DomainModifier[]; + +type RecordModifier = + | ((record: DNSRecord) => void) + | Partial; + +type Duration = + | `${number}${'s' | 'm' | 'h' | 'd' | 'w' | 'n' | 'y' | ''}` + | number /* seconds */; + + +/** + * `FETCH` is a wrapper for the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This allows dynamically setting DNS records based on an external data source, e.g. the API of your cloud provider. + * + * Compared to `fetch` from Fetch API, `FETCH` will call [PANIC](PANIC.md) to terminate the execution of the script, and therefore DNSControl, if a network error occurs. + * + * Otherwise the syntax of `FETCH` is the same as `fetch`. + * + * `FETCH` is not enabled by default. Please read the warnings below. + * + * > WARNING: + * > + * > 1. Relying on external sources adds a point of failure. If the external source doesn't work, your script won't either. Please make sure you are aware of the consequences. + * > 2. Make sure DNSControl only uses verified configuration if you want to use `FETCH`. For example, an attacker can send Pull Requests to your config repo, and have your CI test malicious configurations and make arbitrary HTTP requests. Therefore, `FETCH` must be explicitly enabled with flag `--allow-fetch` on DNSControl invocation. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), [ + * A("@", "1.2.3.4"), + * ]); + * + * FETCH("https://example.com", { + * // All three options below are optional + * headers: {"X-Authentication": "barfoo"}, + * method: "POST", + * body: "Hello World", + * }).then(function(r) { + * return r.text(); + * }).then(function(t) { + * // Example of generating record based on response + * D_EXTEND("example.com", [ + * TXT("@", t.slice(0, 100)), + * ]); + * }); + * ``` + */ +declare function FETCH( + url: string, + init?: { + method?: + | 'GET' + | 'POST' + | 'PUT' + | 'PATCH' + | 'DELETE' + | 'HEAD' + | 'OPTIONS'; + headers?: { [key: string]: string | string[] }; + // Ignored by the underlying code + // redirect: 'follow' | 'error' | 'manual'; + body?: string; + } +): Promise; + +interface FetchResponse { + readonly bodyUsed: boolean; + readonly headers: ResponseHeaders; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly type: string; + + text(): Promise; + json(): Promise; +} + +interface ResponseHeaders { + get(name: string): string | undefined; + getAll(name: string): string[]; + has(name: string): boolean; + + append(name: string, value: string): void; + delete(name: string): void; + set(name: string, value: string): void; +} + + +declare function require(name: `${string}.json`): any; +declare function require(name: string): true; + +/** + * Issuer critical flag. CA that does not understand this tag will refuse to issue certificate for this domain. + * + * CAA record is supported only by BIND, Google Cloud DNS, Amazon Route 53 and OVH. Some certificate authorities may not support this record until the mandatory date of September 2017. + */ +declare const CAA_CRITICAL: RecordModifier; + +/** + * @deprecated + * This disables a safety check intended to prevent: + * 1. Two owners toggling a record between two settings. + * 2. The other owner wiping all records at this label, which won't + * be noticed until the next time dnscontrol is run. + * See https://github.com/StackExchange/dnscontrol/issues/1106 + */ +declare const IGNORE_NAME_DISABLE_SAFETY_CHECK: RecordModifier; + +// Cloudflare aliases: + +/** Proxy disabled. */ +declare const CF_PROXY_OFF: RecordModifier; +/** Proxy enabled. */ +declare const CF_PROXY_ON: RecordModifier; +/** Proxy+Railgun enabled. */ +declare const CF_PROXY_FULL: RecordModifier; + +/** Proxy default off for entire domain (the default) */ +declare const CF_PROXY_DEFAULT_OFF: DomainModifier; +/** Proxy default on for entire domain */ +declare const CF_PROXY_DEFAULT_ON: DomainModifier; +/** UniversalSSL off for entire domain */ +declare const CF_UNIVERSALSSL_OFF: DomainModifier; +/** UniversalSSL on for entire domain */ +declare const CF_UNIVERSALSSL_ON: DomainModifier; + +/** + * Set default values for CLI variables. See: https://dnscontrol.org/cli-variables + */ +declare function CLI_DEFAULTS(vars: Record): void; + +/** + * `END` permits the last item to include a comma. + * + * ```js + * D("foo.com", ... + * A(...), + * A(...), + * A(...), + * END) + * ``` + */ +declare const END: DomainModifier & RecordModifier; + +/** + * Permit labels like `"foo.bar.com.bar.com"` (normally an error) + * + * ```js + * D("bar.com", ... + * A("foo.bar.com", "10.1.1.1", DISABLE_REPEATED_DOMAIN_CHECK), + * ) + * ``` + */ +declare const DISABLE_REPEATED_DOMAIN_CHECK: RecordModifier; + + +/** + * A adds an A record To a domain. The name should be the relative label for the record. Use `@` for the domain apex. + * + * The address should be an ip address, either a string, or a numeric value obtained via [IP](../top-level-functions/IP.md). + * + * Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/language-reference/record-modifiers) or JSON objects, which will be merged into the record's metadata. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("@", "1.2.3.4"), + * A("foo", "2.3.4.5"), + * A("test.foo", IP("1.2.3.4"), TTL(5000)), + * A("*", "1.2.3.4", {foo: 42}) + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/a + */ +declare function A(name: string, address: string | number, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * AAAA adds an AAAA record To a domain. The name should be the relative label for the record. Use `@` for the domain apex. + * + * The address should be an IPv6 address as a string. + * + * Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/language-reference/record-modifiers) or JSON objects, which will be merged into the record's metadata. + * + * ```javascript + * var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334" + * + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * AAAA("@", addrV6), + * AAAA("foo", addrV6), + * AAAA("test.foo", addrV6, TTL(5000)), + * AAAA("*", addrV6, {foo: 42}) + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/aaaa + */ +declare function AAAA(name: string, address: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * AKAMAICDN is a proprietary record type that is used to configure [Zone Apex Mapping](https://blogs.akamai.com/2019/08/fast-dns-zone-apex-mapping-dnssec.html). + * The AKAMAICDN target must be preconfigured in the Akamai network. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/akamai-edge-dns/akamaicdn + */ +declare function AKAMAICDN(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * ALIAS is a virtual record type that points a record at another record. It is analogous to a CNAME, but is usually resolved at request-time and served as an A record. Unlike CNAMEs, ALIAS records can be used at the zone apex (`@`) + * + * Different providers handle ALIAS records differently, and many do not support it at all. Attempting to use ALIAS records with a DNS provider type that does not support them will result in an error. + * + * The name should be the relative label for the domain. + * + * Target should be a string representing the target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * ALIAS("@", "google.com."), // example.com -> google.com + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/alias + */ +declare function ALIAS(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * AUTODNSSEC_OFF tells the provider to disable AutoDNSSEC. It takes no + * parameters. + * + * See `AUTODNSSEC_ON` for further details. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/autodnssec_off + */ +declare const AUTODNSSEC_OFF: DomainModifier; + +/** + * AUTODNSSEC_ON tells the provider to enable AutoDNSSEC. + * + * AUTODNSSEC_OFF tells the provider to disable AutoDNSSEC. + * + * AutoDNSSEC is a feature where a DNS provider can automatically manage + * DNSSEC for a domain. Not all providers support this. + * + * At this time, AUTODNSSEC_ON takes no parameters. There is no ability + * to tune what the DNS provider sets, no algorithm choice. We simply + * ask that they follow their defaults when enabling a no-fuss DNSSEC + * data model. + * + * NOTE: No parenthesis should follow these keywords. That is, the + * correct syntax is `AUTODNSSEC_ON` not `AUTODNSSEC_ON()` + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * AUTODNSSEC_ON, // Enable AutoDNSSEC. + * A("@", "10.1.1.1") + * ); + * + * D("insecure.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * AUTODNSSEC_OFF, // Disable AutoDNSSEC. + * A("@", "10.2.2.2") + * ); + * ``` + * + * If neither `AUTODNSSEC_ON` or `AUTODNSSEC_OFF` is specified for a + * domain no changes will be requested. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/autodnssec_on + */ +declare const AUTODNSSEC_ON: DomainModifier; + +/** + * AZURE_ALIAS is a Azure specific virtual record type that points a record at either another record or an Azure entity. + * It is analogous to a CNAME, but is usually resolved at request-time and served as an A record. + * Unlike CNAMEs, ALIAS records can be used at the zone apex (`@`) + * + * Unlike the regular ALIAS directive, AZURE_ALIAS is only supported on AZURE. + * Attempting to use AZURE_ALIAS on another provider than Azure will result in an error. + * + * The name should be the relative label for the domain. + * + * The type can be any of the following: + * * A + * * AAAA + * * CNAME + * + * Target should be the Azure Id representing the target. It starts `/subscription/`. The resource id can be found in https://resources.azure.com/. + * + * The Target can : + * + * * Point to a public IP resource from a DNS `A/AAAA` record set. + * You can create an A/AAAA record set and make it an alias record set to point to a public IP resource (standard or basic). + * The DNS record set changes automatically if the public IP address changes or is deleted. + * Dangling DNS records that point to incorrect IP addresses are avoided. + * There is a current limit of 20 alias records sets per resource. + * * Point to a Traffic Manager profile from a DNS `A/AAAA/CNAME` record set. + * You can create an A/AAAA or CNAME record set and use alias records to point it to a Traffic Manager profile. + * It's especially useful when you need to route traffic at a zone apex, as traditional CNAME records aren't supported for a zone apex. + * For example, say your Traffic Manager profile is myprofile.trafficmanager.net and your business DNS zone is contoso.com. + * You can create an alias record set of type A/AAAA for contoso.com (the zone apex) and point to myprofile.trafficmanager.net. + * * Point to an Azure Content Delivery Network (CDN) endpoint. + * This is useful when you create static websites using Azure storage and Azure CDN. + * * Point to another DNS record set within the same zone. + * Alias records can reference other record sets of the same type. + * For example, a DNS CNAME record set can be an alias to another CNAME record set. + * This arrangement is useful if you want some record sets to be aliases and some non-aliases. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider("AZURE_DNS"), + * AZURE_ALIAS("foo", "A", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"), // record for traffic manager + * AZURE_ALIAS("foo", "CNAME", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/dnszones/example.com/A/quux."), // record in the same zone + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/azure-dns/azure_alias + */ +declare function AZURE_ALIAS(name: string, type: "A" | "AAAA" | "CNAME", target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `CAA()` adds a CAA record to a domain. The name should be the relative label for the record. Use `@` for the domain apex. + * + * Tag can be one of + * 1. `"issue"` + * 2. `"issuewild"` + * 3. `"iodef"` + * + * Value is a string. The format of the contents is different depending on the tag. DNSControl will handle any escaping or quoting required, similar to TXT records. For example use `CAA("@", "issue", "letsencrypt.org")` rather than `CAA("@", "issue", "\"letsencrypt.org\"")`. + * + * Flags are controlled by modifier: + * - `CAA_CRITICAL`: Issuer critical flag. CA that does not understand this tag will refuse to issue certificate for this domain. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * // Allow letsencrypt to issue certificate for this domain + * CAA("@", "issue", "letsencrypt.org"), + * // Allow no CA to issue wildcard certificate for this domain + * CAA("@", "issuewild", ";"), + * // Report all violation to test@example.com. If CA does not support + * // this record then refuse to issue any certificate + * CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL) + * ); + * ``` + * + * DNSControl contains a [`CAA_BUILDER`](CAA_BUILDER.md) which can be used to simply create `CAA()` records for your domains. Instead of creating each CAA record individually, you can simply configure your report mail address, the authorized certificate authorities and the builder cares about the rest. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/caa + */ +declare function CAA(name: string, tag: "issue" | "issuewild" | "iodef", value: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * DNSControl contains a `CAA_BUILDER` which can be used to simply create + * [`CAA()`](../domain-modifiers/CAA.md) records for your domains. Instead of creating each [`CAA()`](../domain-modifiers/CAA.md) record + * individually, you can simply configure your report mail address, the + * authorized certificate authorities and the builder cares about the rest. + * + * ## Example + * + * ### Simple example + * + * ```javascript + * CAA_BUILDER({ + * label: "@", + * iodef: "mailto:test@example.com", + * iodef_critical: true, + * issue: [ + * "letsencrypt.org", + * "comodoca.com", + * ], + * issuewild: "none", + * }) + * ``` + * + * `CAA_BUILDER()` builds multiple records: + * + * ```javascript + * CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL) + * CAA("@", "issue", "letsencrypt.org") + * CAA("@", "issue", "comodoca.com") + * CAA("@", "issuewild", ";") + * ``` + * + * which in turns yield the following records: + * + * ```text + * @ 300 IN CAA 128 iodef "mailto:test@example.com" + * @ 300 IN CAA 0 issue "letsencrypt.org" + * @ 300 IN CAA 0 issue "comodoca.com" + * @ 300 IN CAA 0 issuewild ";" + * ``` + * + * ### Example with CAA_CRITICAL flag on all records + * + * The same example can be enriched with CAA_CRITICAL on all records: + * + * ```javascript + * CAA_BUILDER({ + * label: "@", + * iodef: "mailto:test@example.com", + * iodef_critical: true, + * issue: [ + * "letsencrypt.org", + * "comodoca.com", + * ], + * issue_critical: true, + * issuewild: "none", + * issuewild_critical: true, + * }) + * ``` + * + * `CAA_BUILDER()` then builds (the same) multiple records - all with CAA_CRITICAL flag set: + * + * ```javascript + * CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL) + * CAA("@", "issue", "letsencrypt.org", CAA_CRITICAL) + * CAA("@", "issue", "comodoca.com", CAA_CRITICAL) + * CAA("@", "issuewild", ";", CAA_CRITICAL) + * ``` + * + * which in turns yield the following records: + * + * ```text + * @ 300 IN CAA 128 iodef "mailto:test@example.com" + * @ 300 IN CAA 128 issue "letsencrypt.org" + * @ 300 IN CAA 128 issue "comodoca.com" + * @ 300 IN CAA 128 issuewild ";" + * ``` + * + * ### Parameters + * + * * `label:` The label of the CAA record. (Optional. Default: `"@"`) + * * `iodef:` Report all violation to configured mail address. + * * `iodef_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`) + * * `issue:` An array of CAs which are allowed to issue certificates. (Use `"none"` to refuse all CAs) + * * `issue_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`) + * * `issuewild:` An array of CAs which are allowed to issue wildcard certificates. (Can be simply `"none"` to refuse issuing wildcard certificates for all CAs) + * * `issuewild_critical:` This can be `true` or `false`. If enabled and CA does not support this record, then certificate issue will be refused. (Optional. Default: `false`) + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/caa_builder + */ +declare function CAA_BUILDER(opts: { label?: string; iodef: string; iodef_critical?: boolean; issue: string[]; issue_critical?: boolean; issuewild: string[]; issuewild_critical?: boolean }): DomainModifier; + +/** + * `CF_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page Rules) to + * generate a HTTP 301 permanent redirect. + * + * If _any_ `CF_REDIRECT` or [`CF_TEMP_REDIRECT`](CF_TEMP_REDIRECT.md) functions are used then + * `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain. + * Page Rule types other than "Forwarding URL” will be left alone. + * + * WARNING: Cloudflare does not currently fully document the Page Rules API and + * this interface is not extensively tested. Take precautions such as making + * backups and manually verifying `dnscontrol preview` output before running + * `dnscontrol push`. This is especially true when mixing Page Rules that are + * managed by DNSControl and those that aren't. + * + * HTTP 301 redirects are cached by browsers forever, usually ignoring any TTLs or + * other cache invalidation techniques. It should be used with great care. We + * suggest using a `CF_TEMP_REDIRECT` initially, then changing to a `CF_REDIRECT` + * only after sufficient time has elapsed to prove this is what you really want. + * + * This example redirects the bare (aka apex, or naked) domain to www: + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * CF_REDIRECT("example.com/*", "https://www.example.com/$1"), + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudflare-dns/cf_redirect + */ +declare function CF_REDIRECT(source: string, destination: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `CF_TEMP_REDIRECT` uses Cloudflare-specific features ("Forwarding URL" Page + * Rules) to generate a HTTP 302 temporary redirect. + * + * If _any_ [`CF_REDIRECT`](CF_REDIRECT.md) or `CF_TEMP_REDIRECT` functions are used then + * `dnscontrol` will manage _all_ "Forwarding URL" type Page Rules for the domain. + * Page Rule types other than "Forwarding URL” will be left alone. + * + * WARNING: Cloudflare does not currently fully document the Page Rules API and + * this interface is not extensively tested. Take precautions such as making + * backups and manually verifying `dnscontrol preview` output before running + * `dnscontrol push`. This is especially true when mixing Page Rules that are + * managed by DNSControl and those that aren't. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * CF_TEMP_REDIRECT("example.example.com/*", "https://otherplace.yourdomain.com/$1"), + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudflare-dns/cf_temp_redirect + */ +declare function CF_TEMP_REDIRECT(source: string, destination: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `CF_WORKER_ROUTE` uses the [Cloudflare Workers](https://developers.cloudflare.com/workers/) + * API to manage [worker routes](https://developers.cloudflare.com/workers/platform/routes) + * for a given domain. + * + * If _any_ `CF_WORKER_ROUTE` function is used then `dnscontrol` will manage _all_ + * Worker Routes for the domain. To be clear: this means it will delete existing routes that + * were created outside of DNSControl. + * + * WARNING: This interface is not extensively tested. Take precautions such as making + * backups and manually verifying `dnscontrol preview` output before running + * `dnscontrol push`. + * + * This example assigns the patterns `api.example.com/*` and `example.com/api/*` to a `my-worker` script: + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * CF_WORKER_ROUTE("api.example.com/*", "my-worker"), + * CF_WORKER_ROUTE("example.com/api/*", "my-worker"), + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudflare-dns/cf_worker_route + */ +declare function CF_WORKER_ROUTE(pattern: string, script: string): DomainModifier; + +/** + * Documentation needed. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/service-provider-specific/cloudns/cloudns_wr + */ +declare function CLOUDNS_WR(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * CNAME adds a CNAME record to the domain. The name should be the relative label for the domain. + * Using `@` or `*` for CNAME records is not recommended, as different providers support them differently. + * + * Target should be a string representing the CNAME target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * CNAME("foo", "google.com."), // foo.example.com -> google.com + * CNAME("abc", "@"), // abc.example.com -> example.com + * CNAME("def", "test"), // def.example.com -> test.example.com + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/cname + */ +declare function CNAME(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `D` adds a new Domain for DNSControl to manage. The first two arguments are required: the domain name (fully qualified `example.com` without a trailing dot), and the + * name of the registrar (as previously declared with [NewRegistrar](NewRegistrar.md)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](NewDnsProvider.md), + * add records with [A](../domain-modifiers/A.md), [CNAME](../domain-modifiers/CNAME.md), and so forth, or add metadata. + * + * Modifier arguments are processed according to type as follows: + * + * - A function argument will be called with the domain object as it's only argument. Most of the [built-in modifier functions](https://docs.dnscontrol.org/language-reference/domain-modifiers-modifiers) return such functions. + * - An object argument will be merged into the domain's metadata collection. + * - An array argument will have all of it's members evaluated recursively. This allows you to combine multiple common records or modifiers into a variable that can + * be used like a macro in multiple domains. + * + * ```javascript + * // simple domain + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("@","1.2.3.4"), + * CNAME("test", "foo.example2.com.") + * ); + * + * // "macro" for records that can be mixed into any zone + * var GOOGLE_APPS_DOMAIN_MX = [ + * MX("@", 1, "aspmx.l.google.com."), + * MX("@", 5, "alt1.aspmx.l.google.com."), + * MX("@", 5, "alt2.aspmx.l.google.com."), + * MX("@", 10, "alt3.aspmx.l.google.com."), + * MX("@", 10, "alt4.aspmx.l.google.com."), + * ] + * + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("@","1.2.3.4"), + * CNAME("test", "foo.example2.com."), + * GOOGLE_APPS_DOMAIN_MX + * ); + * ``` + * + * # Split Horizon DNS + * + * DNSControl supports Split Horizon DNS. Simply + * define the domain two or more times, each with + * their own unique parameters. + * + * To differentiate the different domains, specify the domains as + * `domain.tld!tag`, such as `example.com!inside` and + * `example.com!outside`. + * + * ```javascript + * var REG_THIRDPARTY = NewRegistrar("ThirdParty"); + * var DNS_INSIDE = NewDnsProvider("Cloudflare"); + * var DNS_OUTSIDE = NewDnsProvider("bind"); + * + * D("example.com!inside", REG_THIRDPARTY, DnsProvider(DNS_INSIDE), + * A("www", "10.10.10.10") + * ); + * + * D("example.com!outside", REG_THIRDPARTY, DnsProvider(DNS_OUTSIDE), + * A("www", "20.20.20.20") + * ); + * + * D_EXTEND("example.com!inside", + * A("internal", "10.99.99.99") + * ); + * ``` + * + * A domain name without a `!` is assigned a tag that is the empty + * string. For example, `example.com` and `example.com!` are equivalent. + * However, we strongly recommend against using the empty tag, as it + * risks creating confusion. In other words, if you have `domain.tld` + * and `domain.tld!external` you now require humans to remember that + * `domain.tld` is the external one. I mean... the internal one. You + * may have noticed this mistake, but will your coworkers? Will you in + * six months? You get the idea. + * + * DNSControl command line flag `--domains` matches the full name (with the "!"). If you + * define domains `example.com!george` and `example.com!john` then: + * + * * `--domains=example.com` will not match either domain. + * * `--domains='example.com!george'` will match only match the first. + * * `--domains='example.com!george",example.com!john` will match both. + * + * NOTE: The quotes are required if your shell treats `!` as a special + * character, which is probably does. If you see an error that mentions + * `event not found` you probably forgot the quotes. + * + * @see https://docs.dnscontrol.org/language-reference/top-level-functions/d + */ +declare function D(name: string, registrar: string, ...modifiers: DomainModifier[]): void; + +/** + * `DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [`D`](D.md) will have these + * arguments passed as if they were the first modifiers in the argument list. + * + * ## Example + * + * We want to create backup zone files for all domains, but not actually register them. Also create a [`DefaultTTL`](../domain-modifiers/DefaultTTL.md). + * The domain `example.com` will have the defaults set. + * + * ```javascript + * var COMMON = NewDnsProvider("foo"); + * DEFAULTS( + * DnsProvider(COMMON, 0), + * DefaultTTL("1d") + * ); + * + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("@","1.2.3.4") + * ); + * ``` + * + * If you want to clear the defaults, you can do the following. + * The domain `example2.com` will **not** have the defaults set. + * + * ```javascript + * DEFAULTS(); + * + * D("example2.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("@","1.2.3.4") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/top-level-functions/defaults + */ +declare function DEFAULTS(...modifiers: DomainModifier[]): void; + +/** + * DHCID adds a DHCID record to the domain. + * + * Digest should be a string. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DHCID("example.com", "ABCDEFG") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dhcid + */ +declare function DHCID(name: string, digest: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `DISABLE_IGNORE_SAFETY_CHECK()` disables the safety check. Normally it is an + * error to insert records that match an `IGNORE()` pattern. This disables that + * safety check for the entire domain. + * + * It replaces the per-record `IGNORE_NAME_DISABLE_SAFETY_CHECK()` which is + * deprecated as of DNSControl v4.0.0.0. + * + * See [`IGNORE()`](../domain-modifiers/IGNORE.md) for more information. + * + * ## Syntax + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DISABLE_IGNORE_SAFETY_CHECK, + * ... + * TXT("myhost", "mytext"), + * IGNORE("myhost", "*", "*"), + * ... + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/disable_ignore_safety_check + */ +declare const DISABLE_IGNORE_SAFETY_CHECK: DomainModifier; + +/** + * DNSControl contains a `DMARC_BUILDER` which can be used to simply create + * DMARC policies for your domains. + * + * ## Example + * + * ### Simple example + * + * ```javascript + * DMARC_BUILDER({ + * policy: "reject", + * ruf: [ + * "mailto:mailauth-reports@example.com", + * ], + * }) + * ``` + * + * This yield the following record: + * + * ```text + * @ IN TXT "v=DMARC1; p=reject; ruf=mailto:mailauth-reports@example.com" + * ``` + * + * ### Advanced example + * + * ```javascript + * DMARC_BUILDER({ + * policy: "reject", + * subdomainPolicy: "quarantine", + * percent: 50, + * alignmentSPF: "r", + * alignmentDKIM: "strict", + * rua: [ + * "mailto:mailauth-reports@example.com", + * "https://dmarc.example.com/submit", + * ], + * ruf: [ + * "mailto:mailauth-reports@example.com", + * ], + * failureOptions: "1", + * reportInterval: "1h", + * }); + * ``` + * + * ```javascript + * DMARC_BUILDER({ + * label: "insecure", + * policy: "none", + * ruf: [ + * "mailto:mailauth-reports@example.com", + * ], + * failureOptions: { + * SPF: false, + * DKIM: true, + * }, + * }); + * ``` + * + * This yields the following records: + * + * ```text + * @ IN TXT "v=DMARC1; p=reject; sp=quarantine; adkim=s; aspf=r; pct=50; rua=mailto:mailauth-reports@example.com,https://dmarc.example.com/submit; ruf=mailto:mailauth-reports@example.com; fo=1; ri=3600" + * insecure IN TXT "v=DMARC1; p=none; ruf=mailto:mailauth-reports@example.com; fo=d" + * ``` + * + * ### Parameters + * + * * `label:` The DNS label for the DMARC record (`_dmarc` prefix is added, default: `"@"`) + * * `version:` The DMARC version to be used (default: `DMARC1`) + * * `policy:` The DMARC policy (`p=`), must be one of `"none"`, `"quarantine"`, `"reject"` + * * `subdomainPolicy:` The DMARC policy for subdomains (`sp=`), must be one of `"none"`, `"quarantine"`, `"reject"` (optional) + * * `alignmentSPF:` `"strict"`/`"s"` or `"relaxed"`/`"r"` alignment for SPF (`aspf=`, default: `"r"`) + * * `alignmentDKIM:` `"strict"`/`"s"` or `"relaxed"`/`"r"` alignment for DKIM (`adkim=`, default: `"r"`) + * * `percent:` Number between `0` and `100`, percentage for which policies are applied (`pct=`, default: `100`) + * * `rua:` Array of aggregate report targets (optional) + * * `ruf:` Array of failure report targets (optional) + * * `failureOptions:` Object or string; Object containing booleans `SPF` and `DKIM`, string is passed raw (`fo=`, default: `"0"`) + * * `failureFormat:` Format in which failure reports are requested (`rf=`, default: `"afrf"`) + * * `reportInterval:` Interval in which reports are requested (`ri=`) + * * `ttl:` Input for `TTL` method (optional) + * + * ### Caveats + * + * * TXT records are automatically split using `AUTOSPLIT`. + * * URIs in the `rua` and `ruf` arrays are passed raw. You must percent-encode all commas and exclamation points in the URI itself. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dmarc_builder + */ +declare function DMARC_BUILDER(opts: { label?: string; version?: string; policy: 'none' | 'quarantine' | 'reject'; subdomainPolicy?: 'none' | 'quarantine' | 'reject'; alignmentSPF?: 'strict' | 's' | 'relaxed' | 'r'; alignmentDKIM?: 'strict' | 's' | 'relaxed' | 'r'; percent?: number; rua?: string[]; ruf?: string[]; failureOptions?: { SPF: boolean, DKIM: boolean } | string; failureFormat?: string; reportInterval?: Duration; ttl?: Duration }): DomainModifier; + +/** + * DNAME adds a DNAME record to the domain. + * + * Target should be a string. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DNAME("sub", "example.net.") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dname + */ +declare function DNAME(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * DNSKEY adds a DNSKEY record to the domain. + * + * Flags should be a number. + * + * Protocol should be a number. + * + * Algorithm must be a number. + * + * Public key must be a string. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DNSKEY("@", 257, 3, 13, "AABBCCDD") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dnskey + */ +declare function DNSKEY(name: string, flags: number, protocol: number, algorithm: number, publicKey: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `DOMAIN_ELSEWHERE()` is a helper macro that lets you easily indicate that + * a domain's zones are managed elsewhere. That is, it permits you easily delegate + * a domain to a hard-coded list of DNS servers. + * + * `DOMAIN_ELSEWHERE` is useful when you control a domain's registrar but not the + * DNS servers. For example, suppose you own a domain but the DNS servers are run + * by someone else, perhaps a SaaS product you've subscribed to or a DNS server + * that is run by your brother-in-law who doesn't trust you with the API keys that + * would let you maintain the domain using DNSControl. You need an easy way to + * point (delegate) the domain at a specific list of DNS servers. + * + * For example these two statements are equivalent: + * + * ```javascript + * DOMAIN_ELSEWHERE("example.com", REG_MY_PROVIDER, ["ns1.foo.com", "ns2.foo.com"]); + * ``` + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * NO_PURGE, + * NAMESERVER("ns1.foo.com"), + * NAMESERVER("ns2.foo.com") + * ); + * ``` + * + * NOTE: The [`NO_PURGE`](../domain-modifiers/NO_PURGE.md) is used out of abundance of caution but since no + * `DnsProvider()` statements exist, no updates would be performed. + * + * @see https://docs.dnscontrol.org/language-reference/top-level-functions/domain_elsewhere + */ +declare function DOMAIN_ELSEWHERE(name: string, registrar: string, nameserver_names: string[]): void; + +/** + * `DOMAIN_ELSEWHERE_AUTO()` is similar to `DOMAIN_ELSEWHERE()` but instead of + * a hardcoded list of nameservers, a DnsProvider() is queried. + * + * `DOMAIN_ELSEWHERE_AUTO` is useful when you control a domain's registrar but the + * DNS zones are managed by another system. Luckily you have enough access to that + * other system that you can query it to determine the zone's nameservers. + * + * For example, suppose you own a domain but the DNS servers for it are in Azure. + * Further suppose that something in Azure maintains the zones (automatic or + * human). Azure picks the nameservers for the domains automatically, and that + * list may change occasionally. `DOMAIN_ELSEWHERE_AUTO` allows you to easily + * query Azure to determine the domain's delegations so that you do not need to + * hard-code them in your dnsconfig.js file. + * + * For example these two statements are equivalent: + * + * ```javascript + * DOMAIN_ELSEWHERE_AUTO("example.com", REG_NAMEDOTCOM, DSP_AZURE); + * ``` + * + * ```javascript + * D("example.com", REG_NAMEDOTCOM, + * NO_PURGE, + * DnsProvider(DSP_AZURE) + * ); + * ``` + * + * NOTE: The [`NO_PURGE`](../domain-modifiers/NO_PURGE.md) is used to prevent DNSControl from changing the records. + * + * @see https://docs.dnscontrol.org/language-reference/top-level-functions/domain_elsewhere_auto + */ +declare function DOMAIN_ELSEWHERE_AUTO(name: string, domain: string, registrar: string, dnsProvider: string): void; + +/** + * DS adds a DS record to the domain. + * + * Key Tag should be a number. + * + * Algorithm should be a number. + * + * Digest Type must be a number. + * + * Digest must be a string. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DS("example.com", 2371, 13, 2, "ABCDEF") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/ds + */ +declare function DS(name: string, keytag: number, algorithm: number, digesttype: number, digest: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `D_EXTEND` adds records (and metadata) to a domain previously defined + * by [`D()`](D.md). It can also be used to add subdomain records (and metadata) + * to a previously defined domain. + * + * The first argument is a domain name. If it exactly matches a + * previously defined domain, `D_EXTEND()` behaves the same as [`D()`](D.md), + * simply adding records as if they had been specified in the original + * [`D()`](D.md). + * + * If the domain name does not match an existing domain, but could be a + * (non-delegated) subdomain of an existing domain, the new records (and + * metadata) are added with the subdomain part appended to all record + * names (labels), and targets (as appropriate). See the examples below. + * + * Matching the domain name to previously-defined domains is done using a + * `longest match` algorithm. If `domain.tld` and `sub.domain.tld` are + * defined as separate domains via separate [`D()`](D.md) statements, then + * `D_EXTEND("sub.sub.domain.tld", ...)` would match `sub.domain.tld`, + * not `domain.tld`. + * + * Some operators only act on an apex domain (e.g. + * [`CF_REDIRECT`](../domain-modifiers/CF_REDIRECT.md) and [`CF_TEMP_REDIRECT`](../domain-modifiers/CF_TEMP_REDIRECT.md)). Using them + * in a `D_EXTEND` subdomain may not be what you expect. + * + * ```javascript + * D("domain.tld", REG_MY_PROVIDER, DnsProvider(DNS), + * A("@", "127.0.0.1"), // domain.tld + * A("www", "127.0.0.2"), // www.domain.tld + * CNAME("a", "b") // a.domain.tld -> b.domain.tld + * ); + * D_EXTEND("domain.tld", + * A("aaa", "127.0.0.3"), // aaa.domain.tld + * CNAME("c", "d") // c.domain.tld -> d.domain.tld + * ); + * D_EXTEND("sub.domain.tld", + * A("bbb", "127.0.0.4"), // bbb.sub.domain.tld + * A("ccc", "127.0.0.5"), // ccc.sub.domain.tld + * CNAME("e", "f") // e.sub.domain.tld -> f.sub.domain.tld + * ); + * D_EXTEND("sub.sub.domain.tld", + * A("ddd", "127.0.0.6"), // ddd.sub.sub.domain.tld + * CNAME("g", "h") // g.sub.sub.domain.tld -> h.sub.sub.domain.tld + * ); + * D_EXTEND("sub.domain.tld", + * A("@", "127.0.0.7"), // sub.domain.tld + * CNAME("i", "j") // i.sub.domain.tld -> j.sub.domain.tld + * ); + * ``` + * + * This will end up in the following modifications: (This output assumes the `--full` flag) + * + * ```text + * ******************** Domain: domain.tld + * ----- Getting nameservers from: cloudflare + * ----- DNS Provider: cloudflare...7 corrections + * #1: CREATE A aaa.domain.tld 127.0.0.3 + * #2: CREATE A bbb.sub.domain.tld 127.0.0.4 + * #3: CREATE A ccc.sub.domain.tld 127.0.0.5 + * #4: CREATE A ddd.sub.sub.domain.tld 127.0.0.6 + * #5: CREATE A sub.domain.tld 127.0.0.7 + * #6: CREATE A www.domain.tld 127.0.0.2 + * #7: CREATE A domain.tld 127.0.0.1 + * #8: CREATE CNAME a.domain.tld b.domain.tld. + * #9: CREATE CNAME c.domain.tld d.domain.tld. + * #10: CREATE CNAME e.sub.domain.tld f.sub.domain.tld. + * #11: CREATE CNAME g.sub.sub.domain.tld h.sub.sub.domain.tld. + * #12: CREATE CNAME i.sub.domain.tld j.sub.domain.tld. + * ``` + * + * ProTips: `D_EXTEND()` permits you to create very complex and + * sophisticated configurations, but you shouldn't. Be nice to the next + * person that edits the file, who may not be as expert as yourself. + * Enhance readability by putting any `D_EXTEND()` statements immediately + * after the original [`D()`](D.md), like in above example. Avoid the temptation + * to obscure the addition of records to existing domains with randomly + * placed `D_EXTEND()` statements. Don't build up a domain using loops of + * `D_EXTEND()` statements. You'll be glad you didn't. + * + * @see https://docs.dnscontrol.org/language-reference/top-level-functions/d_extend + */ +declare function D_EXTEND(name: string, ...modifiers: DomainModifier[]): void; + +/** + * DefaultTTL sets the TTL for all subsequent records following it in a domain that do not explicitly set one with [`TTL`](../record-modifiers/TTL.md). If neither `DefaultTTL` or `TTL` exist for a record, + * the record will inherit the DNSControl global internal default of 300 seconds. See also [`DEFAULTS`](../top-level-functions/DEFAULTS.md) to override the internal defaults. + * + * NS records are currently a special case, and do not inherit from `DefaultTTL`. See [`NAMESERVER_TTL`](../domain-modifiers/NAMESERVER_TTL.md) to set a default TTL for all NS records. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DefaultTTL("4h"), + * A("@","1.2.3.4"), // uses default + * A("foo", "2.3.4.5", TTL(600)) // overrides default + * ); + * ``` + * + * The DefaultTTL duration is the same format as [`TTL`](../record-modifiers/TTL.md), an integer number of seconds + * or a string with a unit such as `"4d"`. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/defaultttl + */ +declare function DefaultTTL(ttl: Duration): DomainModifier; + +/** + * DnsProvider indicates that the specified provider should be used to manage + * records for this domain. The name must match the name used with [NewDnsProvider](../top-level-functions/NewDnsProvider.md). + * + * The nsCount parameter determines how the nameservers will be managed from this provider. + * + * Leaving the parameter out means "fetch and use all nameservers from this provider as authoritative". ie: `DnsProvider("name")` + * + * Using `0` for nsCount means "do not fetch nameservers from this domain, or give them to the registrar". + * + * Using a different number, ie: `DnsProvider("name",2)`, means "fetch all nameservers from this provider, + * but limit it to this many. + * + * See [this page](../../nameservers.md) for a detailed explanation of how DNSControl handles nameservers and NS records. + * + * If a domain (`D()`) does not include any `DnsProvider()` functions, + * the DNS records will not be modified. In fact, if you want to control + * the Registrar for a domain but not the DNS records themselves, simply + * do not include a `DnsProvider()` function for that `D()`. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/dnsprovider + */ +declare function DnsProvider(name: string, nsCount?: number): DomainModifier; + +/** + * Documentation needed. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/frame + */ +declare function FRAME(name: string, target: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * HTTPS adds an HTTPS record to a domain. The name should be the relative label for the record. Use `@` for the domain apex. The HTTPS record is a special form of the SVCB resource record. + * + * The priority must be a positive number, the address should be an ip address, either a string, or a numeric value obtained via [IP](../top-level-functions/IP.md). + * + * The params may be configured to specify the `alpn`, `ipv4hint`, `ipv6hint`, `ech` or `port` setting. Several params may be joined by a space. Not existing params may be specified as an empty string `""` + * + * Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/language-reference/record-modifiers) or JSON objects, which will be merged into the record's metadata. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * HTTPS("@", 1, ".", "ipv4hint=123.123.123.123 alpn=h3,h2 port=443"), + * HTTPS("@", 1, "test.com", "") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/https + */ +declare function HTTPS(name: string, priority: number, target: string, params: string, ...modifiers: RecordModifier[]): DomainModifier; + +/** + * `IGNORE()` makes it possible for DNSControl to share management of a domain + * with an external system. The parameters of `IGNORE()` indicate which records + * are managed elsewhere and should not be modified or deleted. + * + * Use case: Suppose a domain is managed by both DNSControl and a third-party + * system. This creates a problem because DNSControl will try to delete records + * inserted by the other system. The other system may get confused and re-insert + * those records. The two systems will get into an endless update cycle where + * each will revert changes made by the other in an endless loop. + * + * To solve this problem simply include `IGNORE()` statements that identify which + * records are managed elsewhere. DNSControl will not modify or delete those + * records. + * + * Technically `IGNORE_NAME` is a promise that DNSControl will not modify or + * delete existing records that match particular patterns. It is like + * [`NO_PURGE`](../domain-modifiers/NO_PURGE.md) that matches only specific records. + * + * Including a record that is ignored is considered an error and may have + * undefined behavior. This safety check can be disabled using the + * [`DISABLE_IGNORE_SAFETY_CHECK`](../domain-modifiers/DISABLE_IGNORE_SAFETY_CHECK.md) feature. + * + * ## Syntax + * + * The `IGNORE()` function can be used with up to 3 parameters: + * + * ```javascript + * IGNORE(labelSpec, typeSpec, targetSpec): + * IGNORE(labelSpec, typeSpec): + * IGNORE(labelSpec): + * ``` + * + * * `labelSpec` is a glob that matches the DNS label. For example `"foo"` or `"foo*"`. `"*"` matches all labels, as does the empty string (`""`). + * * `typeSpec` is a comma-separated list of DNS types. For example `"A"` matches DNS A records, `"A,CNAME"` matches both A and CNAME records. `"*"` matches any DNS type, as does the empty string (`""`). + * * `targetSpec` is a glob that matches the DNS target. For example `"foo"` or `"foo*"`. `"*"` matches all targets, as does the empty string (`""`). + * + * `typeSpec` and `targetSpec` default to `"*"` if they are omitted. + * + * ## Globs + * + * The `labelSpec` and `targetSpec` parameters supports glob patterns in the style + * of the [gobwas/glob](https://github.com/gobwas/glob) library. All of the + * following patterns will work: + * + * * `IGNORE("*.foo")` will ignore all records in the style of `bar.foo`, but will not ignore records using a double subdomain, such as `foo.bar.foo`. + * * `IGNORE("**.foo")` will ignore all subdomains of `foo`, including double subdomains. + * * `IGNORE("?oo")` will ignore all records of three symbols ending in `oo`, for example `foo` and `zoo`. It will not match `.` + * * `IGNORE("[abc]oo")` will ignore records `aoo`, `boo` and `coo`. `IGNORE("[a-c]oo")` is equivalent. + * * `IGNORE("[!abc]oo")` will ignore all three symbol records ending in `oo`, except for `aoo`, `boo`, `coo`. `IGNORE("[!a-c]oo")` is equivalent. + * * `IGNORE("{bar,[fz]oo}")` will ignore `bar`, `foo` and `zoo`. + * * `IGNORE("\\*.foo")` will ignore the literal record `*.foo`. + * + * ## Typical Usage + * + * General examples: + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * IGNORE("foo"), // matches any records on foo.example.com + * IGNORE("baz", "A"), // matches any A records on label baz.example.com + * IGNORE("*", "MX", "*"), // matches all MX records + * IGNORE("*", "CNAME", "dev-*"), // matches CNAMEs with targets prefixed `dev-*` + * IGNORE("bar", "A,MX"), // ignore only A and MX records for name bar + * IGNORE("*", "*", "dev-*"), // Ignore targets with a `dev-` prefix + * IGNORE("*", "A", "1\.2\.3\."), // Ignore targets in the 1.2.3.0/24 CIDR block + * END); + * ``` + * + * Ignore Let's Encrypt (ACME) validation records: + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * IGNORE("_acme-challenge", "TXT"), + * IGNORE("_acme-challenge.**", "TXT"), + * END); + * ``` + * + * Ignore DNS records typically inserted by Microsoft ActiveDirectory: + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * IGNORE("_gc", "SRV"), // General Catalog + * IGNORE("_gc.**", "SRV"), // General Catalog + * IGNORE("_kerberos", "SRV"), // Kerb5 server + * IGNORE("_kerberos.**", "SRV"), // Kerb5 server + * IGNORE("_kpasswd", "SRV"), // Kpassword + * IGNORE("_kpasswd.**", "SRV"), // Kpassword + * IGNORE("_ldap", "SRV"), // LDAP + * IGNORE("_ldap.**", "SRV"), // LDAP + * IGNORE("_msdcs", "NS"), // Microsoft Domain Controller Service + * IGNORE("_msdcs.**", "NS"), // Microsoft Domain Controller Service + * IGNORE("_vlmcs", "SRV"), // FQDN of the KMS host + * IGNORE("_vlmcs.**", "SRV"), // FQDN of the KMS host + * IGNORE("domaindnszones", "A"), + * IGNORE("domaindnszones.**", "A"), + * IGNORE("forestdnszones", "A"), + * IGNORE("forestdnszones.**", "A"), + * END); + * ``` + * + * ## Detailed examples + * + * Here are some examples that illustrate how matching works. + * + * All the examples assume the following DNS records are the "existing" records + * that a third-party is maintaining. (Don't be confused by the fact that we're + * using DNSControl notation for the records. Pretend some other system inserted them.) + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("@", "151.101.1.69"), + * A("www", "151.101.1.69"), + * A("foo", "1.1.1.1"), + * A("bar", "2.2.2.2"), + * CNAME("cshort", "www"), + * CNAME("cfull", "www.plts.org."), + * CNAME("cfull2", "www.bar.plts.org."), + * CNAME("cfull3", "bar.www.plts.org."), + * END); + * + * D_EXTEND("more.example.com", + * A("foo", "1.1.1.1"), + * A("bar", "2.2.2.2"), + * CNAME("mshort", "www"), + * CNAME("mfull", "www.plts.org."), + * CNAME("mfull2", "www.bar.plts.org."), + * CNAME("mfull3", "bar.www.plts.org."), + * END); + * ``` + * + * ```javascript + * IGNORE("@", "", ""), + * // Would match: + * // foo.example.com. A 1.1.1.1 + * // foo.more.example.com. A 1.1.1.1 + * ``` + * + * ```javascript + * IGNORE("example.com.", "", ""), + * // Would match: + * // nothing + * ``` + * + * ```javascript + * IGNORE("foo", "", ""), + * // Would match: + * // foo.example.com. A 1.1.1.1 + * ``` + * + * ```javascript + * IGNORE("foo.**", "", ""), + * // Would match: + * // foo.more.example.com. A 1.1.1.1 + * ``` + * + * ```javascript + * IGNORE("www", "", ""), + * // Would match: + * // www.example.com. A 174.136.107.196 + * ``` + * + * ```javascript + * IGNORE("www.*", "", ""), + * // Would match: + * // nothing + * ``` + * + * ```javascript + * IGNORE("www.example.com", "", ""), + * // Would match: + * // nothing + * ``` + * + * ```javascript + * IGNORE("www.example.com.", "", ""), + * // Would match: + * // none + * ``` + * + * ```javascript + * //IGNORE("", "", "1.1.1.*"), + * // Would match: + * // foo.example.com. A 1.1.1.1 + * // foo.more.example.com. A 1.1.1.1 + * ``` + * + * ```javascript + * //IGNORE("", "", "www"), + * // Would match: + * // none + * ``` + * + * ```javascript + * IGNORE("", "", "*bar*"), + * // Would match: + * // cfull2.example.com. CNAME www.bar.plts.org. + * // cfull3.example.com. CNAME bar.www.plts.org. + * // mfull2.more.example.com. CNAME www.bar.plts.org. + * // mfull3.more.example.com. CNAME bar.www.plts.org. + * ``` + * + * ```javascript + * IGNORE("", "", "bar.**"), + * // Would match: + * // cfull3.example.com. CNAME bar.www.plts.org. + * // mfull3.more.example.com. CNAME bar.www.plts.org. + * ``` + * + * ## Conflict handling + * + * It is considered as an error for a `dnsconfig.js` to both ignore and insert the + * same record in a domain. This is done as a safety mechanism. + * + * This will generate an error: + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * ... + * TXT("myhost", "mytext"), + * IGNORE("myhost", "*", "*"), // Error! Ignoring an item we inserted + * ... + * ``` + * + * To disable this safety check, add the `DISABLE_IGNORE_SAFETY_CHECK` statement + * to the `D()`. + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * DISABLE_IGNORE_SAFETY_CHECK, + * ... + * TXT("myhost", "mytext"), + * IGNORE("myhost", "*", "*"), + * ... + * ``` + * + * FYI: Previously DNSControl permitted disabling this check on + * a per-record basis using `IGNORE_NAME_DISABLE_SAFETY_CHECK`: + * + * The `IGNORE_NAME_DISABLE_SAFETY_CHECK` feature does not exist in the diff2 + * world and its use will result in a validation error. Use the above example + * instead. + * + * ```javascript + * // THIS NO LONGER WORKS! Use DISABLE_IGNORE_SAFETY_CHECK instead. See above. + * TXT("myhost", "mytext", IGNORE_NAME_DISABLE_SAFETY_CHECK), + * ``` + * + * ## Caveats + * + * WARNING: Two systems updating the same domain is complex. Complex things are risky. Use `IGNORE()` + * as a last resort. Even then, test extensively. + * + * * There is no locking. If the external system and DNSControl make updates at the exact same time, the results are undefined. + * * IGNORE` works fine with records inserted into a `D()` via `D_EXTEND()`. The matching is done on the resulting FQDN of the label or target. + * * `targetSpec` does not match fields other than the primary target. For example, `MX` records have a target hostname plus a priority. There is no way to match the priority. + * * The BIND provider can not ignore records it doesn't know about. If it does not have access to an existing zonefile, it will create a zonefile from scratch. That new zonefile will not have any external records. It will seem like they were not ignored, but in reality BIND didn't have visibility to them so that they could be ignored. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/ignore + */ +declare function IGNORE(labelSpec: string, typeSpec?: string, targetSpec?: string): DomainModifier; + +/** + * `IGNORE_NAME(a)` is the same as `IGNORE(a, "*", "*")`. + * + * `IGNORE_NAME(a, b)` is the same as `IGNORE(a, b, "*")`. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/ignore_name + */ +declare function IGNORE_NAME(pattern: string, rTypes?: string): DomainModifier; + +/** + * `IGNORE_TARGET_NAME(target)` is the same as `IGNORE("*", "*", target)`. + * + * `IGNORE_TARGET_NAME(target, rtype)` is the same as `IGNORE("*", rtype, target)`. + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/ignore_target + */ +declare function IGNORE_TARGET(pattern: string, rType: string): DomainModifier; + +/** + * Includes all records from a given domain + * + * ```javascript + * D("example.com!external", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * A("test", "8.8.8.8") + * ); + * + * D("example.com!internal", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * INCLUDE("example.com!external"), + * A("home", "127.0.0.1") + * ); + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/include + */ +declare function INCLUDE(domain: string): DomainModifier; + +/** + * Converts an IPv4 address from string to an integer. This allows performing mathematical operations with the IP address. + * + * ```javascript + * var addrA = IP("1.2.3.4") + * var addrB = addrA + 1 + * // addrB = 1.2.3.5 + * ``` + * + * NOTE: `IP()` does not accept IPv6 addresses (PRs gladly accepted!). IPv6 addresses are simply strings: + * + * ```javascript + * // IPv4 Var + * var addrA1 = IP("1.2.3.4"); + * var addrA2 = "1.2.3.4"; + * + * // IPv6 Var + * var addrAAAA = "0:0:0:0:0:0:0:0"; + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/top-level-functions/ip + */ +declare function IP(ip: string): number; + +/** + * The parameter number types are as follows: + * + * ``` + * name: string + * target: string + * deg1: uint32 + * min1: uint32 + * sec1: float32 + * deg2: uint32 + * min2: uint32 + * sec2: float32 + * altitude: uint32 + * size: float32 + * horizontal_precision: float32 + * vertical_precision: float32 + * ``` + * + * ## Description ## + * + * Strictly follows [RFC 1876](https://datatracker.ietf.org/doc/html/rfc1876). + * + * A LOC record holds a geographical position. In the zone file, it may look like: + * + * ```text + * ; + * pipex.net. LOC 52 14 05 N 00 08 50 E 10m + * ``` + * + * On the wire, it is in a binary format. + * + * A use case for LOC is suggested in the RFC: + * + * > Some uses for the LOC RR have already been suggested, including the + * USENET backbone flow maps, a "visual traceroute" application showing + * the geographical path of an IP packet, and network management + * applications that could use LOC RRs to generate a map of hosts and + * routers being managed. + * + * There is the UK based [https://find.me.uk](https://find.me.uk/) whereby you can do: + * + * ```sh + * dig loc .find.me.uk + * ``` + * + * There are some behaviours that you should be aware of, however: + * + * > If omitted, minutes and seconds default to zero, size defaults to 1m, + * horizontal precision defaults to 10000m, and vertical precision + * defaults to 10m. These defaults are chosen to represent typical + * ZIP/postal code area sizes, since it is often easy to find + * approximate geographical location by ZIP/postal code. + * + * Alas, the world does not revolve around US ZIP codes, but here we are. Internally, + * the LOC record type will supply defaults where values were absent on DNS import. + * One must supply the `LOC()` js helper all parameters. If that seems like too + * much work, see also helper functions: + * + * * [`LOC_BUILDER_DD({})`](LOC_BUILDER_DD.md) - build a `LOC` by supplying only **d**ecimal **d**egrees. + * * [`LOC_BUILDER_DMS_STR({})`](LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](LOC_BUILDER_STR.md) - tries the coordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * ## Format ## + * + * The coordinate format for `LOC()` is: + * + * `degrees,minutes,seconds,[NnSs],deg,min,sec,[EeWw],altitude,size,horizontal_precision,vertical_precision` + * + * ## Examples ## + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * // LOC "subdomain", d1, m1, s1, "[NnSs]", d2, m2, s2, "[EeWw]", alt, siz, hp, vp) + * //42 21 54 N 71 06 18 W -24m 30m + * , LOC("@", 42, 21, 54, "N", 71, 6, 18, "W", -24, 30, 0, 0) + * //42 21 43.952 N 71 5 6.344 W -24m 1m 200m 10m + * , LOC("a", 42, 21, 43.952, "N", 71, 5, 6.344, "W", -24, 1, 200, 10) + * //52 14 05 N 00 08 50 E 10m + * , LOC("b", 52, 14, 5, "N", 0, 8, 50, "E", 10, 0, 0, 0) + * //32 7 19 S 116 2 25 E 10m + * , LOC("c", 32, 7, 19, "S",116, 2, 25, "E", 10, 0, 0, 0) + * //42 21 28.764 N 71 00 51.617 W -44m 2000m + * , LOC("d", 42, 21, 28.764, "N", 71, 0, 51.617, "W", -44, 2000, 0, 0) + * ); + * + * ``` + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/loc + */ +declare function LOC(deg1: number, min1: number, sec1: number, deg2: number, min2: number, sec2: number, altitude: number, size: number, horizontal_precision: number, vertical_precision: number): DomainModifier; + +/** + * `LOC_BUILDER_DD({})` actually takes an object with the following properties: + * + * - label (optional, defaults to `@`) + * - x (float32) + * - y (float32) + * - alt (float32, optional) + * - ttl (optional) + * + * A helper to build [`LOC`](LOC.md) records. Supply four parameters instead of 12. + * + * Internally assumes some defaults for [`LOC`](LOC.md) records. + * + * The cartesian coordinates are decimal degrees, like you typically find in e.g. Google Maps. + * + * Examples. + * + * Big Ben: + * `51.50084265331501, -0.12462541415599787` + * + * The White House: + * `38.89775977858357, -77.03655125982903` + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * LOC_BUILDER_DD({ + * label: "big-ben", + * x: 51.50084265331501, + * y: -0.12462541415599787, + * alt: 6, + * }) + * , LOC_BUILDER_DD({ + * label: "white-house", + * x: 38.89775977858357, + * y: -77.03655125982903, + * alt: 19, + * }) + * , LOC_BUILDER_DD({ + * label: "white-house-ttl", + * x: 38.89775977858357, + * y: -77.03655125982903, + * alt: 19, + * ttl: "5m", + * }) + * ); + * + * ``` + * + * Part of the series: + * * [`LOC()`](LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](LOC_BUILDER_STR.md) - tries the coordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/loc_builder_dd + */ +declare function LOC_BUILDER_DD(opts: { label?: string; x: number; y: number; alt?: number; ttl?: Duration }): DomainModifier; + +/** + * `LOC_BUILDER_DMM({})` actually takes an object with the following properties: + * + * - label (string, optional, defaults to `@`) + * - str (string) + * - alt (float32, optional) + * - ttl (optional) + * + * A helper to build [`LOC`](LOC.md) records. Supply three parameters instead of 12. + * + * Internally assumes some defaults for [`LOC`](LOC.md) records. + * + * Accepts a string with decimal minutes (DMM) coordinates in the form: 25.24°S 153.15°E + * + * Note that the following are acceptable forms (symbols differ): + * * `25.24°S 153.15°E` + * * `25.24 S 153.15 E` + * * `25.24° S 153.15° E` + * * `25.24S 153.15E` + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * LOC_BUILDER_STR({ + * label: "tasmania", + * str: "42°S 147°E", + * alt: 3, + * }) + * ); + * + * ``` + * + * Part of the series: + * * [`LOC()`](LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](LOC_BUILDER_STR.md) - tries the coordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/loc_builder_dmm_str + */ +declare function LOC_BUILDER_DMM_STR(opts: { label?: string; str: string; alt?: number; ttl?: Duration }): DomainModifier; + +/** + * `LOC_BUILDER_DMS_STR({})` actually takes an object with the following properties: + * + * - label (string, optional, defaults to `@`) + * - str (string) + * - alt (float32, optional) + * - ttl (optional) + * + * A helper to build [`LOC`](LOC.md) records. Supply three parameters instead of 12. + * + * Internally assumes some defaults for [`LOC`](LOC.md) records. + * + * Accepts a string with degrees, minutes, and seconds (DMS) coordinates in the form: 41°24'12.2"N 2°10'26.5"E + * + * Note that the following are acceptable forms (symbols differ): + * * `33°51′31″S 151°12′51″E` + * * `33°51'31"S 151°12'51"E` + * * `33d51m31sS 151d12m51sE` + * * `33d51m31s S 151d12m51s E` + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * LOC_BUILDER_DMS_STR({ + * label: "sydney-opera-house", + * str: "33°51′31″S 151°12′51″E", + * alt: 4, + * ttl: "5m", + * }) + * ); + * + * ``` + * + * Part of the series: + * * [`LOC()`](LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](LOC_BUILDER_STR.md) - tries the coordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/loc_builder_dms_str + */ +declare function LOC_BUILDER_DMS_STR(opts: { label?: string; str: string; alt?: number; ttl?: Duration }): DomainModifier; + +/** + * `LOC_BUILDER_STR({})` actually takes an object with the following: properties. + * + * - label (optional, defaults to `@`) + * - str (string) + * - alt (float32, optional) + * - ttl (optional) + * + * A helper to build [`LOC`](LOC.md) records. Supply three parameters instead of 12. + * + * Internally assumes some defaults for [`LOC`](LOC.md) records. + * + * Accepts a string and tries all `LOC_BUILDER_DM*_STR({})` methods: + * * [`LOC_BUILDER_DMS_STR({})`](LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * + * ```javascript + * D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), + * , LOC_BUILDER_STR({ + * label: "old-faithful", + * str: "44.46046°N 110.82815°W", + * alt: 2240, + * }) + * , LOC_BUILDER_STR({ + * label: "ribblehead-viaduct", + * str: "54.210436°N 2.370231°W", + * alt: 300, + * }) + * , LOC_BUILDER_STR({ + * label: "guinness-brewery", + * str: "53°20′40″N 6°17′20″W", + * alt: 300, + * }) + * ); + * + * ``` + * + * Part of the series: + * * [`LOC()`](LOC.md) - build a `LOC` by supplying all 12 parameters + * * [`LOC_BUILDER_DD({})`](LOC_BUILDER_DD.md) - accepts cartesian x, y + * * [`LOC_BUILDER_DMS_STR({})`](LOC_BUILDER_DMS_STR.md) - accepts DMS 33°51′31″S 151°12′51″E + * * [`LOC_BUILDER_DMM_STR({})`](LOC_BUILDER_DMM_STR.md) - accepts DMM 25.24°S 153.15°E + * * [`LOC_BUILDER_STR({})`](LOC_BUILDER_STR.md) - tries the coordinate string in all `LOC_BUILDER_DM*_STR()` functions until one works + * + * @see https://docs.dnscontrol.org/language-reference/domain-modifiers/loc_builder_str + */ +declare function LOC_BUILDER_STR(opts: { label?: string; str: string; alt?: number; ttl?: Duration }): DomainModifier; + +/** + * DNSControl offers a `M365_BUILDER` which can be used to simply set up Microsoft 365 for a domain in an opinionated way. + * + * It defaults to a setup without support for legacy Skype for Business applications. + * It doesn't set up SPF or DMARC. See [`SPF_BUILDER`](SPF_BUILDER.md) and [`DMARC_BUILDER`](DMARC_BUILDER.md). + * + * ## Example + * + * ### Simple example + * + * ```javascript + * M365_BUILDER({ + * initialDomain: "example.onmicrosoft.com", + * }); + * ``` + * + * This sets up `MX` records, Autodiscover, and DKIM. + * + * ### Advanced example + * + * ```javascript + * M365_BUILDER({ + * label: "test", + * mx: false, + * autodiscover: false, + * dkim: false, + * mdm: true, + * domainGUID: "test-example-com", // Can be automatically derived in this case, if example.com is the context. + * initialDomain: "example.onmicrosoft.com", + * }); + * ``` + * + * This sets up Mobile Device Management only. + * + * ### Parameters + * + * * `label` The label of the Microsoft 365 domain, useful if it is a subdomain (default: `"@"`) + * * `mx` Set an `MX` record? (default: `true`) + * * `autodiscover` Set Autodiscover `CNAME` record? (default: `true`) + * * `dkim` Set DKIM `CNAME` records? (default: `true`) + * * `skypeForBusiness` Set Skype for Business/Microsoft Teams records? (default: `false`) + * * `mdm` Set Mobile Device Management records? (default: `false`) + * * `domainGUID` The GUID of _this_ Microsoft 365 domain (default: `