mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
ClouDNS: Add CLOUDNS_WR (Web Redirects) (#1421)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
@ -32,6 +32,20 @@ DS records in the same update, the NS records will be inserted first.
|
|||||||
## Metadata
|
## Metadata
|
||||||
This provider does not recognize any special metadata fields unique to ClouDNS.
|
This provider does not recognize any special metadata fields unique to ClouDNS.
|
||||||
|
|
||||||
|
## Web Redirects
|
||||||
|
ClouDNS supports ClouDNS-specific "WR record (web redirects)" for your domains.
|
||||||
|
Simply use the `CLOUDNS_WR` functions to make redirects like any other record:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var REG_NONE = NewRegistrar('none', 'NONE')
|
||||||
|
var CLOUDNS = NewDnsProvider("cloudns", "CLOUDNS");
|
||||||
|
|
||||||
|
D("example.tld", REG_NONE, DnsProvider(CLOUDNS),
|
||||||
|
CLOUDNS_WR('@', 'http://example.com/'),
|
||||||
|
CLOUDNS_WR('www', 'http://example.com/')
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
Example Javascript:
|
Example Javascript:
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func (dc *DomainConfig) Punycode() error {
|
|||||||
|
|
||||||
// Set the target:
|
// Set the target:
|
||||||
switch rec.Type { // #rtype_variations
|
switch rec.Type { // #rtype_variations
|
||||||
case "ALIAS", "MX", "NS", "CNAME", "PTR", "SRV", "URL", "URL301", "FRAME", "R53_ALIAS", "NS1_URLFWD", "AKAMAICDN":
|
case "ALIAS", "MX", "NS", "CNAME", "PTR", "SRV", "URL", "URL301", "FRAME", "R53_ALIAS", "NS1_URLFWD", "AKAMAICDN", "CLOUDNS_WR":
|
||||||
// These rtypes are hostnames, therefore need to be converted (unlike, for example, an AAAA record)
|
// These rtypes are hostnames, therefore need to be converted (unlike, for example, an AAAA record)
|
||||||
t, err := idna.ToASCII(rec.GetTargetField())
|
t, err := idna.ToASCII(rec.GetTargetField())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -45,6 +45,7 @@ import (
|
|||||||
// PURGE
|
// PURGE
|
||||||
// URL
|
// URL
|
||||||
// URL301
|
// URL301
|
||||||
|
// CLOUDNS_WR
|
||||||
//
|
//
|
||||||
// Notes about the fields:
|
// Notes about the fields:
|
||||||
//
|
//
|
||||||
|
@ -873,6 +873,7 @@ var URL = recordBuilder('URL');
|
|||||||
var URL301 = recordBuilder('URL301');
|
var URL301 = recordBuilder('URL301');
|
||||||
var FRAME = recordBuilder('FRAME');
|
var FRAME = recordBuilder('FRAME');
|
||||||
var NS1_URLFWD = recordBuilder('NS1_URLFWD');
|
var NS1_URLFWD = recordBuilder('NS1_URLFWD');
|
||||||
|
var CLOUDNS_WR = recordBuilder('CLOUDNS_WR');
|
||||||
|
|
||||||
// SPF_BUILDER takes an object:
|
// SPF_BUILDER takes an object:
|
||||||
// parts: The parts of the SPF record (to be joined with ' ').
|
// parts: The parts of the SPF record (to be joined with ' ').
|
||||||
|
@ -59,6 +59,7 @@ func init() {
|
|||||||
RecordAuditor: AuditRecords,
|
RecordAuditor: AuditRecords,
|
||||||
}
|
}
|
||||||
providers.RegisterDomainServiceProviderType("CLOUDNS", fns, features)
|
providers.RegisterDomainServiceProviderType("CLOUDNS", fns, features)
|
||||||
|
providers.RegisterCustomRecordType("CLOUDNS_WR", "CLOUDNS", "WR")
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNameservers returns the nameservers for a domain.
|
// GetNameservers returns the nameservers for a domain.
|
||||||
@ -278,7 +279,7 @@ func toReq(rc *models.RecordConfig) (requestParams, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch rc.Type { // #rtype_variations
|
switch rc.Type { // #rtype_variations
|
||||||
case "A", "AAAA", "NS", "PTR", "TXT", "SOA", "ALIAS", "CNAME":
|
case "A", "AAAA", "NS", "PTR", "TXT", "SOA", "ALIAS", "CNAME", "WR":
|
||||||
// Nothing special.
|
// Nothing special.
|
||||||
case "MX":
|
case "MX":
|
||||||
req["priority"] = strconv.Itoa(int(rc.MxPreference))
|
req["priority"] = strconv.Itoa(int(rc.MxPreference))
|
||||||
|
Reference in New Issue
Block a user