mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
DOCS: Improve consistency in code examples in language reference (#2439)
Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
committed by
GitHub
parent
0bf24d0282
commit
7977a7b81c
@@ -36,7 +36,7 @@ This example redirects the bare (aka apex, or naked) domain to www:
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"),
|
||||
CF_REDIRECT("example.com/*", "https://www.example.com/$1"),
|
||||
);
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
@@ -29,7 +29,7 @@ managed by DNSControl and those that aren't.
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"),
|
||||
CF_TEMP_REDIRECT("example.example.com/*", "https://otherplace.yourdomain.com/$1"),
|
||||
);
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
@@ -13,8 +13,8 @@ See [`IGNORE()`](../domain/IGNORE.md) for more information.
|
||||
|
||||
## Syntax
|
||||
|
||||
```
|
||||
D("example.com", ...
|
||||
```javascript
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
DISABLE_IGNORE_SAFETY_CHECK,
|
||||
...
|
||||
TXT("myhost", "mytext"),
|
||||
|
||||
@@ -70,7 +70,7 @@ General examples:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", ...
|
||||
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
|
||||
@@ -86,7 +86,7 @@ Ignore Let's Encrypt (ACME) validation records:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
IGNORE("_acme-challenge", "TXT"),
|
||||
IGNORE("_acme-challenge.**", "TXT"),
|
||||
END);
|
||||
@@ -97,7 +97,7 @@ Ignore DNS records typically inserted by Microsoft ActiveDirectory:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", ...
|
||||
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
|
||||
@@ -128,7 +128,7 @@ using DNSControl notation for the records. Pretend some other system inserted th
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", ...
|
||||
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"),
|
||||
@@ -261,7 +261,7 @@ This will generate an error:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
...
|
||||
TXT("myhost", "mytext"),
|
||||
IGNORE("myhost", "*", "*"), // Error! Ignoring an item we inserted
|
||||
@@ -274,7 +274,7 @@ to the `D()`.
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
DISABLE_IGNORE_SAFETY_CHECK,
|
||||
...
|
||||
TXT("myhost", "mytext"),
|
||||
|
||||
@@ -102,7 +102,7 @@ The coordinate format for `LOC()` is:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com","none"
|
||||
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)
|
||||
|
||||
@@ -83,7 +83,7 @@ It looks like this:
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
var REG_THIRDPARTY = NewRegistrar("ThirdParty");
|
||||
D("mydomain.com", REG_THIRDPARTY,
|
||||
D("example.com", REG_THIRDPARTY,
|
||||
...
|
||||
)
|
||||
```
|
||||
|
||||
@@ -25,7 +25,7 @@ parameter_types:
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider("DNS_BIND"),
|
||||
SOA("@", "ns3.example.org.", "hostmaster@example.org", 3600, 600, 604800, 1440),
|
||||
SOA("@", "ns3.example.com.", "hostmaster@example.com", 3600, 600, 604800, 1440),
|
||||
);
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
@@ -25,8 +25,8 @@ Priority, weight, and port are ints.
|
||||
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.com."),
|
||||
SRV("_sip._tcp", 10, 20, 5060, "smallbox1.example.com."),
|
||||
);
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
@@ -41,7 +41,7 @@ var GOOGLE_APPS_DOMAIN_MX = [
|
||||
MX("@", 10, "alt4.aspmx.l.google.com."),
|
||||
]
|
||||
|
||||
D("example.com", REGISTRAR, DnsProvider(r53),
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(r53),
|
||||
A("@","1.2.3.4"),
|
||||
CNAME("test", "foo.example2.com."),
|
||||
GOOGLE_APPS_DOMAIN_MX
|
||||
|
||||
@@ -23,7 +23,7 @@ of the call.
|
||||
```javascript
|
||||
require("kubernetes/clusters.js");
|
||||
|
||||
D("mydomain.net", REG_MY_PROVIDER, PROVIDER,
|
||||
D("example.com", REG_MY_PROVIDER, PROVIDER,
|
||||
IncludeKubernetes()
|
||||
);
|
||||
```
|
||||
@@ -77,8 +77,8 @@ for (var domain in domains) {
|
||||
{% code title="domain-ip-map.json" %}
|
||||
```javascript
|
||||
{
|
||||
"mydomain.net": "1.1.1.1",
|
||||
"myotherdomain.org": "5.5.5.5"
|
||||
"example.com": "1.1.1.1",
|
||||
"other-example.com``": "5.5.5.5"
|
||||
}
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
@@ -28,7 +28,7 @@ For example you can use:
|
||||
```javascript
|
||||
CAA_BUILDER({
|
||||
label: "@",
|
||||
iodef: "mailto:test@domain.tld",
|
||||
iodef: "mailto:test@example.com",
|
||||
iodef_critical: true,
|
||||
issue: [
|
||||
"letsencrypt.org",
|
||||
@@ -51,7 +51,7 @@ The parameters are:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
CAA("@", "iodef", "mailto:test@domain.tld", CAA_CRITICAL)
|
||||
CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
|
||||
CAA("@", "issue", "letsencrypt.org")
|
||||
CAA("@", "issue", "comodoca.com")
|
||||
CAA("@", "issuewild", ";")
|
||||
|
||||
@@ -41,8 +41,8 @@ The White House:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com","none"
|
||||
, LOC_BUILDER_DD({
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
LOC_BUILDER_DD({
|
||||
label: "big-ben",
|
||||
x: 51.50084265331501,
|
||||
y: -0.12462541415599787,
|
||||
|
||||
@@ -35,7 +35,7 @@ Note that the following are acceptable forms (symbols differ):
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com","none"
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
LOC_BUILDER_STR({
|
||||
label: "tasmania",
|
||||
str: "42°S 147°E",
|
||||
|
||||
@@ -35,7 +35,7 @@ Note that the following are acceptable forms (symbols differ):
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com","none"
|
||||
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",
|
||||
|
||||
@@ -32,7 +32,7 @@ Accepts a string and tries all `LOC_BUILDER_DM*_STR({})` methods:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com","none"
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
, LOC_BUILDER_STR({
|
||||
label: "old-faithful",
|
||||
str: "44.46046°N 110.82815°W",
|
||||
|
||||
@@ -39,7 +39,7 @@ Here is an example of how SPF settings are normally done:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.tld", REG_MY_PROVIDER, DNS, ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
TXT("v=spf1 ip4:198.252.206.0/24 ip4:192.111.0.0/24 include:_spf.google.com include:mailgun.org include:spf-basic.fogcreek.com include:mail.zendesk.com include:servers.mcsv.net include:sendgrid.net include:450622.spf05.hubspotemail.net ~all")
|
||||
)
|
||||
```
|
||||
@@ -55,9 +55,9 @@ This has a few problems:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.tld", REG_MY_PROVIDER, DSP, ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
A("@", "10.2.2.2"),
|
||||
MX("@", "example.tld."),
|
||||
MX("@", "example.com."),
|
||||
SPF_BUILDER({
|
||||
label: "@",
|
||||
overflow: "_spf%d",
|
||||
@@ -98,7 +98,7 @@ When you want to specify SPF settings for a domain, use the
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.tld", REG_MY_PROVIDER, DSP, ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
...
|
||||
...
|
||||
...
|
||||
@@ -305,11 +305,11 @@ var SPF_MYSETTINGS = SPF_BUILDER({
|
||||
]
|
||||
});
|
||||
|
||||
D("example.tld", REG_MY_PROVIDER, DSP, ...
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
SPF_MYSETTINGS
|
||||
);
|
||||
|
||||
D("example2.tld", REG_MY_PROVIDER, DSP, ...
|
||||
D("example2.tld", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
|
||||
SPF_MYSETTINGS
|
||||
);
|
||||
```
|
||||
|
||||
@@ -26,7 +26,7 @@ The value can be:
|
||||
|
||||
{% code title="dnsconfig.js" %}
|
||||
```javascript
|
||||
D("example.com", REGISTRAR, DnsProvider("R53"),
|
||||
D("example.com", REG_MY_PROVIDER, DnsProvider("R53"),
|
||||
DefaultTTL(2000),
|
||||
A("@","1.2.3.4"), // uses default
|
||||
A("foo", "2.3.4.5", TTL(500)), // overrides default
|
||||
|
||||
Reference in New Issue
Block a user