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

Support ALIAS records with Cloudflare (#89)

* simple facility for registering provider capabilities

* support for cloudflare. tests.

* js and docs

* docs

* generate
This commit is contained in:
Craig Peterson
2017-04-19 13:13:28 -06:00
committed by GitHub
parent ffb2ee7673
commit fb14cea91e
14 changed files with 265 additions and 89 deletions

View File

@ -0,0 +1,25 @@
---
name: ALIAS
parameters:
- name
- target
- modifiers...
---
ALIAS is a virtual record type that points a record at another record. It is analagous 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 `.`.
{% include startExample.html %}
{% highlight js %}
D("example.com", REGISTRAR, DnsProvider("CLOUDFLARE"),
ALIAS("@", "google.com."), // example.com -> google.com
);
{%endhighlight%}
{% include endExample.html %}

25
docs/alias.md Normal file
View File

@ -0,0 +1,25 @@
---
layout: default
---
# ALIAS records
ALIAS records are not widely standardized across DNS providers. Some (Route 53, DNSimple) have a native ALIAS record type. Others (Cloudflare) implement transparent CNAME flattening.
DNSControl adds an ALIAS record type, and leaves it up to the provider implementation to handle it.
A few notes:
1. A provider must "opt-in" to supporting ALIAS records. When registering a provider, you specify which capabilities you support. Here is an example of how the
cloudflare provider declares its support for aliases:
```
func init() {
providers.RegisterDomainServiceProviderType("CLOUDFLAREAPI", newCloudflare, providers.CanUseAlias)
}
```
2. If you try to use ALIAS records, **all** dns providers for the domain must support ALIAS records. We do not want to serve inconsistent records across providers.
3. CNAMEs at `@` are disallowed, but ALIAS is allowed.
4. Cloudflare does not have a native ALIAS type, but CNAMEs behave similarly. The Cloudflare provider "rewrites" ALIAS records to CNAME as it sees them. Other providers may not need this step.

View File

@ -23,3 +23,4 @@ Dnscontrol is a platform for seamlessly managing your dns configuration across a
- [Why CNAME/MX/NS targets require a trailing "dot"]({{site.github.url}}/why-the-dot)
- [Writing Providers]({{site.github.url}}/writing-providers)
- [ALIAS records in dnscontrol]({{site.github.url}}/alias)