1
0
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:
tpdn
2022-03-02 23:21:51 +09:00
committed by GitHub
parent 1f741088a9
commit fc75f89271
5 changed files with 19 additions and 2 deletions

View File

@ -32,6 +32,20 @@ DS records in the same update, the NS records will be inserted first.
## Metadata
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
Example Javascript:

View File

@ -77,7 +77,7 @@ func (dc *DomainConfig) Punycode() error {
// Set the target:
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)
t, err := idna.ToASCII(rec.GetTargetField())
if err != nil {

View File

@ -45,6 +45,7 @@ import (
// PURGE
// URL
// URL301
// CLOUDNS_WR
//
// Notes about the fields:
//

View File

@ -873,6 +873,7 @@ var URL = recordBuilder('URL');
var URL301 = recordBuilder('URL301');
var FRAME = recordBuilder('FRAME');
var NS1_URLFWD = recordBuilder('NS1_URLFWD');
var CLOUDNS_WR = recordBuilder('CLOUDNS_WR');
// SPF_BUILDER takes an object:
// parts: The parts of the SPF record (to be joined with ' ').

View File

@ -59,6 +59,7 @@ func init() {
RecordAuditor: AuditRecords,
}
providers.RegisterDomainServiceProviderType("CLOUDNS", fns, features)
providers.RegisterCustomRecordType("CLOUDNS_WR", "CLOUDNS", "WR")
}
// GetNameservers returns the nameservers for a domain.
@ -278,7 +279,7 @@ func toReq(rc *models.RecordConfig) (requestParams, error) {
}
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.
case "MX":
req["priority"] = strconv.Itoa(int(rc.MxPreference))