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

adding docs again

This commit is contained in:
Craig Peterson
2017-01-11 13:02:45 -07:00
parent 8e5257c497
commit 7ba051d750
40 changed files with 761 additions and 0 deletions

View File

@ -0,0 +1,26 @@
---
name: A
parameters:
- name
- address
- modifiers...
---
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](#IP).
Modifers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
{% include startExample.html %}
{% highlight js %}
D("example.com", REGISTRAR, DnsProvider("R53"),
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})
);
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,28 @@
---
name: AAAA
parameters:
- name
- address
- modifiers...
---
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.
Modifers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.
{% include startExample.html %}
{% highlight js %}
var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
D("example.com", REGISTRAR, DnsProvider("R53"),
AAAA("@", addrV6),
AAAA("foo", addrV6),
AAAA("test.foo", addrV6, TTL(5000)),
AAAA("*", addrV6, {foo: 42})
);
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,24 @@
---
name: CNAME
parameters:
- name
- address
- modifiers...
---
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.
Adress 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 `.`.
{% include startExample.html %}
{% highlight js %}
D("example.com", REGISTRAR, DnsProvider("R53"),
CNAME("foo", "google.com."), // foo.example.com -> google.com
CNAME("abc", "@"), // abc.example.com -> example.com
CNAME("def", "test.subdomain"), // def.example.com -> test.subdomain.example.com
);
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,20 @@
---
name: DefaultTTL
parameters:
- ttl
---
DefaultTTL sets the TTL for all records in a domain that do not explicitly set one with [TTL](#TTL). If neither `DefaultTTl` or `TTL` exist for a record,
it will use the DNSControl global default of 300 seconds.
{% include startExample.html %}
{% highlight js %}
D("example.com", REGISTRAR, DnsProvider("R53"),
DefaultTTL(2000),
A("@","1.2.3.4"), //has default
A("foo", "2.3.4.5", TTL(500)) //overrides default
);
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,21 @@
---
name: DnsProvider
parameters:
- name
- nsCount
---
DnsProvider indicates that the specifid provider should be used to manage
records for this domain. The name must match the name used with [NewDnsProvider](#NewDnsProvider).
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]({{site.github.url}}/nameservers) for a detailed explanation of how DNSControl handles nameservers and NS records.

View File

View File

View File

View File

View File

View File

@ -0,0 +1,47 @@
---
name: D
parameters:
- name
- registrar
- modifiers...
---
`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)). Any number of additional arguments may be included to add DNS Providers with [DNSProvider](#DNSProvider),
add records with [A](#A), [CNAME](#CNAME), 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](#domain-modifiers) return such functions.
- An object argument will be merged into the domain's metadata collection.
- An array arument 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.
{% include startExample.html %}
{% highlight js %}
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
//simple domain
D("example.com", REGISTRAR, DnsProvider(r53),
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", REGISTRAR, DnsProvider(r53),
A("@","1.2.3.4"),
CNAME("test", "foo.example2.com."),
GOOGLE_APPS_DOMAIN_MX
);
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,23 @@
---
name: DEFAULTS
parameters:
- modifiers...
---
`DEFAULTS` allows you to declare a set of default arguments to apply to all subsequent domains. Subsequent calls to [D](#D) will have these
arguments passed as if they were the first modifiers in the argument list.
{% include startExample.html %}
{% highlight js %}
var COMMON = NewDnsProvider("foo","BIND");
//we want to create backup zone files for all domains, but not actually register them.
//also create a default TTL
DEFAULTS( DnsProvider(COMMON,0), DefaultTTL(1000));
D("example.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); //this domain will have the defaults set.
//clear defaults
DEFAULTS();
D("example2.com", REGISTRAR, DnsProvider("R53"), A("@","1.2.3.4")); //this domain will not have the previous defaults.
{%endhighlight%}
{% include endExample.html %}

View File

View File

@ -0,0 +1,24 @@
---
name: NewDnsProvider
parameters:
- name
- type
- meta
return: string
---
NewDnsProvider registers a new DNS Service Provider. The name can be any string value you would like to use.
The type must match a valid dns provider type identifer (see [provider page.]({{site.github.url}}/provider-list))
Metadata is an optional object, that will only be used by certain providers. See [individual provider docs]({{site.github.url}}/provider-list) for specific details.
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
{% include startExample.html %}
{% highlight js %}
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,24 @@
---
name: NewRegistrar
parameters:
- name
- type
- meta
return: string
---
NewRegistrar registers a registrar provider. The name can be any string value you would like to use.
The type must match a valid registar provider type identifer (see [provider page.]({{site.github.url}}/provider-list))
Metadata is an optional object, that will only be used by certain providers. See [individual provider docs]({{site.github.url}}/provider-list) for specific details.
This function will return the name as a string so that you may assign it to a variable to use inside [D](#D) directives.
{% include startExample.html %}
{% highlight js %}
var REGISTRAR = NewRegistrar("name.com", "NAMEDOTCOM");
var r53 = NewDnsProvider("R53","ROUTE53");
D("example.com", REGISTRAR, DnsProvider(r53), A("@","1.2.3.4"));
{%endhighlight%}
{% include endExample.html %}

View File

@ -0,0 +1,20 @@
---
name: TTL
parameters:
- ttl
---
TTL sets the TTL for a single record only. This will take precedence
over the domain's [DefaultTTL](#DefaultTTL) if supplied.
{% include startExample.html %}
{% highlight js %}
D("example.com", REGISTRAR, DnsProvider("R53"),
DefaultTTL(2000),
A("@","1.2.3.4"), //has default
A("foo", "2.3.4.5", TTL(500)) //overrides default
);
{%endhighlight%}
{% include endExample.html %}