1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

DOCS: consistency in code examples in language reference (#2394)

This commit is contained in:
Jeffrey Cafferata
2023-05-24 22:09:22 +02:00
committed by GitHub
parent 0b7dabacc8
commit e97cf01744
59 changed files with 691 additions and 548 deletions

View File

@ -18,7 +18,7 @@ Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/la
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("R53"),
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
A("@", "1.2.3.4"),
A("foo", "2.3.4.5"),
A("test.foo", IP("1.2.3.4"), TTL(5000)),

View File

@ -20,7 +20,7 @@ Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/la
```javascript
var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
D("example.com", REGISTRAR, DnsProvider("R53"),
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
AAAA("@", addrV6),
AAAA("foo", addrV6),
AAAA("test.foo", addrV6, TTL(5000)),

View File

@ -20,7 +20,7 @@ Target should be a string representing the target. If it is a single label we wi
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("CLOUDFLARE"),
D("example.com", REG_MY_PROVIDER, DnsProvider("CLOUDFLARE"),
ALIAS("@", "google.com."), // example.com -> google.com
);
```

View File

@ -21,12 +21,12 @@ correct syntax is `AUTODNSSEC_ON` not `AUTODNSSEC_ON()`
{% code title="dnsconfig.js" %}
```javascript
D("example.com", .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
AUTODNSSEC_ON, // Enable AutoDNSSEC.
A("@", "10.1.1.1")
);
D("insecure.com", .... ,
D("insecure.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
AUTODNSSEC_OFF, // Disable AutoDNSSEC.
A("@", "10.2.2.2")
);

View File

@ -50,7 +50,7 @@ This arrangement is useful if you want some record sets to be aliases and some n
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("AZURE_DNS"),
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
);

View File

@ -26,7 +26,7 @@ Flags are controlled by modifier:
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
D("example.com", REG_MY_PROVIDER, DnsProvider("GCLOUD"),
// Allow letsencrypt to issue certificate for this domain
CAA("@", "issue", "letsencrypt.org"),
// Allow no CA to issue wildcard certificate for this domain

View File

@ -35,7 +35,7 @@ This example redirects the bare (aka apex, or naked) domain to www:
{% code title="dnsconfig.js" %}
```javascript
D("foo.com", .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"),
);
```

View File

@ -28,7 +28,7 @@ managed by DNSControl and those that aren't.
{% code title="dnsconfig.js" %}
```javascript
D("foo.com", .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"),
);
```

View File

@ -23,13 +23,13 @@ backups and manually verifying `dnscontrol preview` output before running
`dnscontrol push`.
{% endhint %}
This example assigns the patterns `api.foo.com/*` and `foo.com/api/*` to a `my-worker` script:
This example assigns the patterns `api.example.com/*` and `example.com/api/*` to a `my-worker` script:
{% code title="dnsconfig.js" %}
```javascript
D("foo.com", .... ,
CF_WORKER_ROUTE("api.foo.com/*", "my-worker"),
CF_WORKER_ROUTE("foo.com/api/*", "my-worker"),
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"),
);
```
{% endcode %}

View File

@ -17,7 +17,7 @@ Target should be a string representing the CNAME target. If it is a single label
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("R53"),
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
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

View File

@ -28,7 +28,7 @@ Digest must be a string.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider(R53),
D("example.com", REG_MY_PROVIDER, DnsProvider(R53),
DS("example.com", 2371, 13, 2, "ABCDEF")
);
```

View File

@ -14,13 +14,13 @@ NS records are currently a special case, and do not inherit from `DefaultTTL`. S
{% code title="dnsconfig.js" %}
```javascript
D('example.com', REGISTRAR, DnsProvider('R53'),
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
DefaultTTL("4h"),
A('@','1.2.3.4'), // uses default
A('foo', '2.3.4.5', TTL(600)) // overrides default
A("@","1.2.3.4"), // uses default
A("foo", "2.3.4.5", TTL(600)) // overrides default
);
```
{% endcode %}
The DefaultTTL duration is the same format as [`TTL`](../record/TTL.md), an integer number of seconds
or a string with a unit such as `'4d'`.
or a string with a unit such as `"4d"`.

View File

@ -36,7 +36,7 @@ In this example, DNSControl will insert/update the "baz.example.com" record but
{% code title="dnsconfig.js" %}
```javascript
D("example.com",
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
IGNORE_NAME("foo"), // ignore all record types for name foo
IGNORE_NAME("baz", "*"), // ignore all record types for name baz
IGNORE_NAME("bar", "A,MX"), // ignore only A and MX records for name bar
@ -87,7 +87,7 @@ is trying to insert.
You can override this error by adding the
`IGNORE_NAME_DISABLE_SAFETY_CHECK` flag to the record.
TXT('vpn', "this thing", IGNORE_NAME_DISABLE_SAFETY_CHECK)
TXT("vpn", "this thing", IGNORE_NAME_DISABLE_SAFETY_CHECK)
Disabling this safety check creates two risks:

View File

@ -34,8 +34,8 @@ In this example, DNSControl will insert/update the "baz.example.com" record but
{% code title="dnsconfig.js" %}
```javascript
D("example.com",
IGNORE_TARGET('**.acm-validations.aws.', 'CNAME'),
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
IGNORE_TARGET("**.acm-validations.aws.", "CNAME"),
A("baz", "1.2.3.4")
);
```

View File

@ -51,16 +51,16 @@ var TRANSFORM_INT = [
{ low: "2.4.6.80", high: "2.4.6.90", newBase: "123.123.123.200" }, // Another rule, just to show that you can have many.
]
D("foo.com", .... ,
D("foo.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
A("one","1.2.3.1")
A("two","1.2.3.2")
A("three","1.2.3.13")
A("four","1.2.3.14")
);
D("bar.com", .... ,
D("bar.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
A("www","123.123.123.123")
IMPORT_TRANSFORM(TRANSFORM_INT, 'foo.com', 300),
IMPORT_TRANSFORM(TRANSFORM_INT, "foo.com", 300),
);
```
{% endcode %}
@ -68,4 +68,4 @@ D("bar.com", .... ,
Transform rules are: RANGE_START, RANGE_END, NEW_BASE. NEW_BASE may be:
* An IP address. Rebase the IP address on this IP address. Extract the host part of the /24 and add it to the "new base" address.
* A list of IP addresses. For each A record, inject an A record for each item in the list: `newBase: ['1.2.3.100', '2.4.6.8.100']` would produce 2 records for each A record.
* A list of IP addresses. For each A record, inject an A record for each item in the list: `newBase: ["1.2.3.100", "2.4.6.8.100"]` would produce 2 records for each A record.

View File

@ -11,11 +11,11 @@ Includes all records from a given domain
{% code title="dnsconfig.js" %}
```javascript
D("example.com!external", REGISTRAR, DnsProvider(R53),
D("example.com!external", REG_MY_PROVIDER, DnsProvider(R53),
A("test", "8.8.8.8")
);
D("example.com!internal", REGISTRAR, DnsProvider(R53),
D("example.com!internal", REG_MY_PROVIDER, DnsProvider(R53),
INCLUDE("example.com!external"),
A("home", "127.0.0.1")
);

View File

@ -102,7 +102,7 @@ The coordinate format for `LOC()` is:
{% code title="dnsconfig.js" %}
```javascript
D("foo.com","none"
D("example.com","none"
// 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)

View File

@ -20,7 +20,7 @@ Target should be a string representing the MX target. If it is a single label we
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider(R53),
D("example.com", REG_MY_PROVIDER, DnsProvider(R53),
MX("@", 5, "mail"), // mx example.com -> mail.example.com
MX("sub", 10, "mail.foo.com.")
);

View File

@ -8,7 +8,7 @@ parameter_types:
"modifiers...": RecordModifier[]
---
`NAMESERVER()` instructs DNSControl to inform the domain's registrar where to find this zone.
`NAMESERVER()` instructs DNSControl to inform the domain"s registrar where to find this zone.
For some registrars this will also add NS records to the zone itself.
This takes exactly one argument: the name of the nameserver. It must end with
@ -22,14 +22,14 @@ For more information, refer to [this page](../../nameservers.md).
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
DnsProvider(route53, 0),
// Replace the nameservers:
NAMESERVER("ns1.myserver.com."),
NAMESERVER("ns2.myserver.com."),
);
D("example2.com", REGISTRAR, .... ,
D("example2.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
// Add these two additional nameservers to the existing list of nameservers.
NAMESERVER("ns1.myserver.com."),
NAMESERVER("ns2.myserver.com."),
@ -56,7 +56,7 @@ the registrar who does the hard work of talking to the people that
control `.com`. If the domain was `gmeet.io`, the registrar does
the right thing to talk to the people that control `.io`.
(A better name might have been `PARENTNAMESERVER()` but we didn't
(A better name might have been `PARENTNAMESERVER()` but we didn"t
think of that at the time.)
Each registrar handles delegations differently. Most use
@ -82,7 +82,7 @@ It looks like this:
{% code title="dnsconfig.js" %}
```javascript
var REG_THIRDPARTY = NewRegistrar('ThirdParty', 'NONE')
var REG_THIRDPARTY = NewRegistrar("ThirdParty");
D("mydomain.com", REG_THIRDPARTY,
...
)

View File

@ -14,24 +14,24 @@ The value can be an integer or a string. See [`TTL`](../record/TTL.md) for examp
{% code title="dnsconfig.js" %}
```javascript
D('example.com', REGISTRAR, DnsProvider('R53'),
NAMESERVER_TTL('2d'),
NAMESERVER('ns')
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
NAMESERVER_TTL("2d"),
NAMESERVER("ns")
);
```
{% endcode %}
Use `NAMESERVER_TTL('3600'),` or `NAMESERVER_TTL('1h'),` for a 1h default TTL for all subsequent `NS` entries:
Use `NAMESERVER_TTL("3600"),` or `NAMESERVER_TTL("1h"),` for a 1h default TTL for all subsequent `NS` entries:
{% code title="dnsconfig.js" %}
```javascript
D('example.com', REGISTRAR, DnsProvider('xyz'),
D("example.com", REG_MY_PROVIDER, DnsProvider("xyz"),
DefaultTTL("4h"),
NAMESERVER_TTL('3600'),
NAMESERVER('ns1.provider.com.'), //inherits NAMESERVER_TTL
NAMESERVER('ns2.provider.com.'), //inherits NAMESERVER_TTL
A('@','1.2.3.4'), // inherits DefaultTTL
A('foo', '2.3.4.5', TTL(600)) // overrides DefaultTTL for this record only
NAMESERVER_TTL("3600"),
NAMESERVER("ns1.provider.com."), //inherits NAMESERVER_TTL
NAMESERVER("ns2.provider.com."), //inherits NAMESERVER_TTL
A("@","1.2.3.4"), // inherits DefaultTTL
A("foo", "2.3.4.5", TTL(600)) // overrides DefaultTTL for this record only
);
```
{% endcode %}

View File

@ -26,9 +26,9 @@ NAPTR adds a NAPTR record to the domain. Various formats exist. NAPTR is a part
### `subdomain`
Subdomain of the domain (e.g. `example.com`) this entry represents.
Subdomain of the domain (e.g. `example.com`) this entry represents.
#### E164
#### E164
In the case of E164 (e.g. `3.2.1.5.5.5.0.0.8.1.e164.arpa.`) - where [`terminalflag`](#terminalflag) is `u` - the final digit of the zone it represents, or the zone apex record `@`. For example, the ARPA zone `3.2.1.5.5.5.0.0.8.1.e164.arpa.` represents the phone number block 001800555123*X* (or the synonymous +1800555123*X*), where *X* is the final digit of the phone number string, i.e. the [`subdomain`](#subdomain).
@ -59,7 +59,7 @@ Flags called 'terminal' halt the looping rewrite algorithm of DNS.
### `service`
(case insensitive)
*`protocol+rs`* where *`protocol`* defines the protocol used by the DDDS application. *`rs`* is the resolution service. There may be 0 or more resolution services each separated by `+`. ENUM further defines this to be a type field and allows a subtype separated by a colon (`:`).
*`protocol+rs`* where *`protocol`* defines the protocol used by the DDDS application. *`rs`* is the resolution service. There may be 0 or more resolution services each separated by `+`. ENUM further defines this to be a type field and allows a subtype separated by a colon (`:`).
For E164, typically one of `E2U+SIP` (or `E2U+sip`) or `E2U+email`. For SIP, typically `SIPS+D2T` for TCP/TLS `sips:` URIs, or TLS `sip:` URIs, or `SIP+D2T` for TCP based SIP, or `SIP+D2U` for UDP based SIP. Note that SCTP, WS and WSS are also available.
@ -134,20 +134,20 @@ U-NAPTR supported regexp fields must be of the form (from the RFC):
```text
"!.*!<URI>!"
# the .* (any character 1 or more times)
# is fixed by the RFC and essentially ignores
# is fixed by the RFC and essentially ignores
# the AUS data. The result will always be URI
```
### `target`
A (replacement) record for the target - format depends on [`terminalflag`](#terminalflag).
A (replacement) record for the target - format depends on [`terminalflag`](#terminalflag).
* A [`SRV`](SRV.md), if the [`terminalflag`](#terminalflag) is `s` (syntax: *`_Service._Proto.Name`*)
* An [`A`](A.md) or [`AAAA`](AAAA.md) if the [`terminalflag`](#terminalflag) is `a`
* URI if the [`terminalflag`](#terminalflag) is `u`
Not all examples are guaranteed to be standards compliant, or correct.
Not all examples are guaranteed to be standards compliant, or correct.
## Examples
@ -157,16 +157,16 @@ Individual e164 records
{% code title="dnsconfig.js" %}
```javascript
D("3.2.1.5.5.5.0.0.8.1.e164.arpa.", REGISTRAR, DnsProvider(R53),
NAPTR('1', 10, 10, "u", "E2U+SIP", "!^.*$!sip:bob@example.com!", "."),
NAPTR('2', 10, 10, "u", "E2U+SIP", "!^.*$!sip:alice@example.com!", "."),
NAPTR('4', 10, 10, "u", "E2U+SIP", "!^.*$!sip:kate@example.com!", "."),
NAPTR('5', 10, 10, "u", "E2U+SIP", "!^.*$!sip:steve@example.com!", "."),
NAPTR('6', 10, 10, "u", "E2U+SIP", "!^.*$!sip:joe@example.com!", "."),
NAPTR('7', 10, 10, "u", "E2U+SIP", "!^.*$!sip:jane@example.com!", "."),
NAPTR('8', 10, 10, "u", "E2U+SIP", "!^.*$!sip:mike@example.com!", "."),
NAPTR('9', 10, 10, "u", "E2U+SIP", "!^.*$!sip:linda@example.com!", "."),
NAPTR('0', 10, 10, "u", "E2U+SIP", "!^.*$!sip:fax@example.com!", ".")
D("3.2.1.5.5.5.0.0.8.1.e164.arpa.", REG_MY_PROVIDER, DnsProvider(R53),
NAPTR("1", 10, 10, "u", "E2U+SIP", "!^.*$!sip:bob@example.com!", "."),
NAPTR("2", 10, 10, "u", "E2U+SIP", "!^.*$!sip:alice@example.com!", "."),
NAPTR("4", 10, 10, "u", "E2U+SIP", "!^.*$!sip:kate@example.com!", "."),
NAPTR("5", 10, 10, "u", "E2U+SIP", "!^.*$!sip:steve@example.com!", "."),
NAPTR("6", 10, 10, "u", "E2U+SIP", "!^.*$!sip:joe@example.com!", "."),
NAPTR("7", 10, 10, "u", "E2U+SIP", "!^.*$!sip:jane@example.com!", "."),
NAPTR("8", 10, 10, "u", "E2U+SIP", "!^.*$!sip:mike@example.com!", "."),
NAPTR("9", 10, 10, "u", "E2U+SIP", "!^.*$!sip:linda@example.com!", "."),
NAPTR("0", 10, 10, "u", "E2U+SIP", "!^.*$!sip:fax@example.com!", ".")
);
```
{% endcode %}
@ -174,10 +174,10 @@ D("3.2.1.5.5.5.0.0.8.1.e164.arpa.", REGISTRAR, DnsProvider(R53),
Single e164 zone
{% code title="dnsconfig.js" %}
```javascript
D("4.3.2.1.5.5.5.0.0.8.1.e164.arpa.", REGISTRAR, DnsProvider(R53),
NAPTR('@', 100, 50, "u", "E2U+SIP", "!^.*$!sip:customer-service@example.com!", "."),
NAPTR('@', 101, 50, "u", "E2U+email", "!^.*$!mailto:information@example.com!", "."),
NAPTR('@', 101, 50, "u", "smtp+E2U", "!^.*$!mailto:information@example.com!", ".")
D("4.3.2.1.5.5.5.0.0.8.1.e164.arpa.", REG_MY_PROVIDER, DnsProvider(R53),
NAPTR("@", 100, 50, "u", "E2U+SIP", "!^.*$!sip:customer-service@example.com!", "."),
NAPTR("@", 101, 50, "u", "E2U+email", "!^.*$!mailto:information@example.com!", "."),
NAPTR("@", 101, 50, "u", "smtp+E2U", "!^.*$!mailto:information@example.com!", ".")
);
```
{% endcode %}
@ -187,17 +187,17 @@ D("4.3.2.1.5.5.5.0.0.8.1.e164.arpa.", REGISTRAR, DnsProvider(R53),
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider(R53),
NAPTR('@', 20, 50, "s", "SIPS+D2T", "", "_sips._tcp.example.com."),
NAPTR('@', 20, 50, "s", "SIP+D2T", "", "_sip._tcp.example.com."),
NAPTR('@', 30, 50, "s", "SIP+D2U", "", "_sip._udp.example.com."),
NAPTR('help', 100, 50, "s", "SIP+D2U", "!^.*$!sip:customer-service@example.com!", "_sip._udp.example.com."),
NAPTR('help', 101, 50, "s", "SIP+D2T", "!^.*$!sip:customer-service@example.com!", "_sip._tcp.example.com."),
SRV('_sip._udp', 100, 0, 5060, 'sip.example.com.'),
SRV('_sip._tcp', 100, 0, 5060, 'sip.example.com.'),
SRV('_sips._tcp', 100, 0, 5061, 'sip.example.com.'),
A('sip', '192.0.2.2'),
AAAA('sip', '2001:db8::85a3'),
D("example.com", REG_MY_PROVIDER, DnsProvider(R53),
NAPTR("@", 20, 50, "s", "SIPS+D2T", "", "_sips._tcp.example.com."),
NAPTR("@", 20, 50, "s", "SIP+D2T", "", "_sip._tcp.example.com."),
NAPTR("@", 30, 50, "s", "SIP+D2U", "", "_sip._udp.example.com."),
NAPTR("help", 100, 50, "s", "SIP+D2U", "!^.*$!sip:customer-service@example.com!", "_sip._udp.example.com."),
NAPTR("help", 101, 50, "s", "SIP+D2T", "!^.*$!sip:customer-service@example.com!", "_sip._tcp.example.com."),
SRV("_sip._udp", 100, 0, 5060, "sip.example.com."),
SRV("_sip._tcp", 100, 0, 5060, "sip.example.com."),
SRV("_sips._tcp", 100, 0, 5061, "sip.example.com."),
A("sip", "192.0.2.2"),
AAAA("sip", "2001:db8::85a3"),
// and so on
);
```
@ -208,14 +208,14 @@ D("example.com", REGISTRAR, DnsProvider(R53),
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider(R53),
NAPTR('@',100, 50, "a", "z3950+N2L+N2C", "", "cidserver.example.com."),
NAPTR('@', 50, 50, "a", "rcds+N2C", "", "cidserver.example.com."),
NAPTR('@', 30, 50, "s", "http+N2L+N2C+N2R", "", "www.example.com."),
NAPTR('www',100,100, "s", "http+I2R", "", "_http._tcp.example.com."),
NAPTR('www',100,100, "s", "ftp+I2R", "", "_ftp._tcp.example.com."),
SRV('_z3950._tcp', 0, 0, 1000, 'z3950.beast.example.com.'),
SRV('_http._tcp', 10, 0, 80, 'foo.example.com.'),
D("example.com", REG_MY_PROVIDER, DnsProvider(R53),
NAPTR("@",100, 50, "a", "z3950+N2L+N2C", "", "cidserver.example.com."),
NAPTR("@", 50, 50, "a", "rcds+N2C", "", "cidserver.example.com."),
NAPTR("@", 30, 50, "s", "http+N2L+N2C+N2R", "", "www.example.com."),
NAPTR("www",100,100, "s", "http+I2R", "", "_http._tcp.example.com."),
NAPTR("www",100,100, "s", "ftp+I2R", "", "_ftp._tcp.example.com."),
SRV("_z3950._tcp", 0, 0, 1000, "z3950.beast.example.com."),
SRV("_http._tcp", 10, 0, 80, "foo.example.com."),
// and so on
);
```

View File

@ -27,7 +27,7 @@ in place.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", .... , NO_PURGE,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), NO_PURGE,
A("foo","1.2.3.4")
);
```

View File

@ -20,7 +20,7 @@ Target should be a string representing the NS target. If it is a single label we
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("R53"),
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
NS("foo", "ns1.example2.com."), // Delegate ".foo.example.com" zone to another server.
NS("foo", "ns2.example2.com."), // Delegate ".foo.example.com" zone to another server.
A("ns1.example2.com", "10.10.10.10"), // Glue records

View File

@ -32,8 +32,8 @@ IPv6 is properly handled too.
*Extra Validation:* DNSControl considers it an error to include a name that
is inappropriate for the domain. For example
`PTR('1.2.3.4', 'f.co.')` is valid for the domain `D("3.2.1.in-addr.arpa',`
but DNSControl will generate an error if the domain is `D("9.9.9.in-addr.arpa',`.
`PTR("1.2.3.4", "f.co.")` is valid for the domain `D("3.2.1.in-addr.arpa",`
but DNSControl will generate an error if the domain is `D("9.9.9.in-addr.arpa",`.
This is because `1.2.3.4` is contained in `1.2.3.0/24` but not `9.9.9.0/24`.
This validation works for IPv6, IPv4, and
RFC2317 "Classless in-addr.arpa delegation" domains.
@ -45,12 +45,12 @@ name is contained within the CIDR block implied by domain. For example
if name is `4.3.2.1.in-addr.arpa.` (note the trailing `.`)
and the domain is `2.1.in-addr.arpa` (no trailing `.`)
then the name will be replaced with `4.3`. Note that the output
of `REV('1.2.3.4')` is `4.3.2.1.in-addr.arpa.`, which means the following
of `REV("1.2.3.4")` is `4.3.2.1.in-addr.arpa.`, which means the following
are all equivalent:
* `PTR(REV('1.2.3.4'), `
* `PTR('4.3.2.1.in-addr.arpa.'), `
* `PTR('4.3',` // Assuming the domain is `2.1.in-addr.arpa`
* `PTR(REV("1.2.3.4"), `
* `PTR("4.3.2.1.in-addr.arpa."), `
* `PTR("4.3",` // Assuming the domain is `2.1.in-addr.arpa`
All magic is RFC2317-aware. We use the first format listed in the
RFC for both [`REV()`](../global/REV.md) and `PTR()`. The format is
@ -62,31 +62,31 @@ and A, B, C are the first 3 octets of the IP address. For example
{% code title="dnsconfig.js" %}
```javascript
D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND),
PTR('1', 'foo.example.com.'),
PTR('2', 'bar.example.com.'),
PTR('3', 'baz.example.com.'),
D(REV("1.2.3.0/24"), REGISTRAR, DnsProvider(BIND),
PTR("1", "foo.example.com."),
PTR("2", "bar.example.com."),
PTR("3", "baz.example.com."),
// If the first parameter is a valid IP address, DNSControl will generate the correct name:
PTR('1.2.3.10', 'ten.example.com.'), // '10'
PTR("1.2.3.10", "ten.example.com."), // "10"
);
```
{% endcode %}
{% code title="dnsconfig.js" %}
```javascript
D(REV('9.9.9.128/25'), REGISTRAR, DnsProvider(BIND),
PTR('9.9.9.129', 'first.example.com.'),
D(REV("9.9.9.128/25"), REGISTRAR, DnsProvider(BIND),
PTR("9.9.9.129", "first.example.com."),
);
```
{% endcode %}
{% code title="dnsconfig.js" %}
```javascript
D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND),
PTR('1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0', 'foo.example.com.'), // 2001:db8:302::1
D(REV("2001:db8:302::/48"), REGISTRAR, DnsProvider(BIND),
PTR("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0", "foo.example.com."), // 2001:db8:302::1
// If the first parameter is a valid IP address, DNSControl will generate the correct name:
PTR('2001:db8:302::2', 'two.example.com.'), // '2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
PTR('2001:db8:302::3', 'three.example.com.'), // '3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0'
PTR("2001:db8:302::2", "two.example.com."), // "2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
PTR("2001:db8:302::3", "three.example.com."), // "3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"
);
```
{% endcode %}

View File

@ -14,7 +14,7 @@ These three examples all are equivalent.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
);
```
{% endcode %}
@ -23,7 +23,7 @@ Purge is the default, but we set it anyway:
{% code title="dnsconfig.js" %}
```javascript
D("example.com", .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
PURGE,
);
```
@ -33,7 +33,7 @@ Since the "last command wins", this is the same as `PURGE`:
{% code title="dnsconfig.js" %}
```javascript
D("example.com", .... ,
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
PURGE,
NO_PURGE,
PURGE,

View File

@ -39,12 +39,12 @@ The zone id can be found depending on the target type:
{% code title="dnsconfig.js" %}
```javascript
D('example.com', REGISTRAR, DnsProvider('ROUTE53'),
R53_ALIAS('foo', 'A', 'bar'), // record in same zone
R53_ALIAS('foo', 'A', 'bar', R53_ZONE('Z35SXDOTRQ7X7K')), // record in same zone, zone specified
R53_ALIAS('foo', 'A', 'blahblah.elasticloadbalancing.us-west-1.amazonaws.com.', R53_ZONE('Z368ELLRRE2KJ0')), // a classic ELB in us-west-1
R53_ALIAS('foo', 'A', 'blahblah.elasticbeanstalk.us-west-2.amazonaws.com.', R53_ZONE('Z38NKT9BP95V3O')), // an Elastic Beanstalk environment in us-west-2
R53_ALIAS('foo', 'A', 'blahblah-bucket.s3-website-us-west-1.amazonaws.com.', R53_ZONE('Z2F56UZL2M1ACD')), // a website S3 Bucket in us-west-1
D("example.com", REG_MY_PROVIDER, DnsProvider("ROUTE53"),
R53_ALIAS("foo", "A", "bar"), // record in same zone
R53_ALIAS("foo", "A", "bar", R53_ZONE("Z35SXDOTRQ7X7K")), // record in same zone, zone specified
R53_ALIAS("foo", "A", "blahblah.elasticloadbalancing.us-west-1.amazonaws.com.", R53_ZONE("Z368ELLRRE2KJ0")), // a classic ELB in us-west-1
R53_ALIAS("foo", "A", "blahblah.elasticbeanstalk.us-west-2.amazonaws.com.", R53_ZONE("Z38NKT9BP95V3O")), // an Elastic Beanstalk environment in us-west-2
R53_ALIAS("foo", "A", "blahblah-bucket.s3-website-us-west-1.amazonaws.com.", R53_ZONE("Z2F56UZL2M1ACD")), // a website S3 Bucket in us-west-1
);
```
{% endcode %}

View File

@ -24,7 +24,7 @@ parameter_types:
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REG_THIRDPARTY, DnsProvider("DNS_BIND"),
D("example.com", REG_MY_PROVIDER, DnsProvider("DNS_BIND"),
SOA("@", "ns3.example.org.", "hostmaster@example.org", 3600, 600, 604800, 1440),
);
```

View File

@ -22,11 +22,11 @@ Priority, weight, and port are ints.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
D("example.com", REG_MY_PROVIDER, DnsProvider("GCLOUD"),
// Create SRV records for a a SIP service:
// pr w port, target
SRV('_sip._tcp', 10, 60, 5060, 'bigbox.example.tld.'),
SRV('_sip._tcp', 10, 20, 5060, 'smallbox1.example.tld.'),
SRV("_sip._tcp", 10, 60, 5060, "bigbox.example.tld."),
SRV("_sip._tcp", 10, 20, 5060, "smallbox1.example.tld."),
);
```
{% endcode %}

View File

@ -38,6 +38,6 @@ parameter_types:
{% code title="dnsconfig.js" %}
```javascript
SSHFP('@', 1, 1, '00yourAmazingFingerprint00'),
SSHFP("@", 1, 1, "00yourAmazingFingerprint00"),
```
{% endcode %}

View File

@ -24,7 +24,7 @@ Certificate is a hex string.
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
D("example.com", REG_MY_PROVIDER, DnsProvider("GCLOUD"),
// Create TLSA record for certificate used on TCP port 443
TLSA("_443._tcp", 3, 1, 1, "abcdef0"),
);

View File

@ -24,13 +24,13 @@ Modifiers can be any number of [record modifiers](https://docs.dnscontrol.org/la
{% code title="dnsconfig.js" %}
```javascript
D("example.com", REGISTRAR, ....,
TXT('@', '598611146-3338560'),
TXT('listserve', 'google-site-verification=12345'),
TXT('multiple', ['one', 'two', 'three']), // Multiple strings
TXT('quoted', 'any "quotes" and escapes? ugh; no worries!'),
TXT('_domainkey', 't=y; o=-;'), // Escapes are done for you automatically.
TXT('long', 'X'.repeat(300)) // Long strings are split automatically.
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
TXT("@", "598611146-3338560"),
TXT("listserve", "google-site-verification=12345"),
TXT("multiple", ["one", "two", "three"]), // Multiple strings
TXT("quoted", "any "quotes" and escapes? ugh; no worries!"),
TXT("_domainkey", "t=y; o=-;"), // Escapes are done for you automatically.
TXT("long", "X".repeat(300)) // Long strings are split automatically.
);
```
{% endcode %}