Skip to content

Commit

Permalink
CNR: Add support for ALIAS record type (#3360)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsifNawaz-cnic authored Jan 14, 2025
1 parent d13cf0f commit a3d6c51
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Currently supported Domain Registrars:

- AWS Route 53
- CSC Global
- CentralNic Reseller (formerly RRPProxy)
- CentralNic Reseller (CNR) - formerly RRPProxy
- DNSOVERHTTPS
- Dynadot
- easyname
Expand Down
2 changes: 1 addition & 1 deletion documentation/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
* [Azure Private DNS](provider/azure_private_dns.md)
* [BIND](provider/bind.md)
* [Bunny DNS](provider/bunny\_dns.md)
* [CentralNic Reseller (fka RRPproxy)](provider/cnr.md)
* [CentralNic Reseller (CNR) - formerly RRPProxy](provider/cnr.md)
* [Cloudflare](provider/cloudflareapi.md)
* [ClouDNS](provider/cloudns.md)
* [CSC Global](provider/cscglobal.md)
Expand Down
2 changes: 1 addition & 1 deletion documentation/provider/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If a feature is definitively not supported for whatever reason, we would also li
| [`BUNNY_DNS`](bunny_dns.md) ||||||||||||||||||||||||
| [`CLOUDFLAREAPI`](cloudflareapi.md) ||||||||||||||||||||||||
| [`CLOUDNS`](cloudns.md) ||||||||||||||||||||||||
| [`CNR`](cnr.md) ||||| |||||||||||||||||||
| [`CNR`](cnr.md) ||||| |||||||||||||||||||
| [`CSCGLOBAL`](cscglobal.md) ||||||||||||||||||||||||
| [`DESEC`](desec.md) ||||||||||||||||||||||||
| [`DIGITALOCEAN`](digitalocean.md) ||||||||||||||||||||||||
Expand Down
2 changes: 1 addition & 1 deletion providers/cnr/cnrProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var features = providers.DocumentationNotes{
providers.DocOfficiallySupported: providers.Cannot("Actively maintained provider module."),
// --- Supported record types ---
// providers.CanUseAKAMAICDN: providers.Cannot(), // can only be supported by Akamai EdgeDns provider
providers.CanUseAlias: providers.Cannot("Not supported. You may use CNAME records instead. An Alternative solution is planned."),
providers.CanUseAlias: providers.Can(),
// providers.CanUseAzureAlias: providers.Cannot(), // can only be supported by Azure provider
providers.CanUseCAA: providers.Can(),
providers.CanUseDHCID: providers.Cannot("Ask for this feature."),
Expand Down
8 changes: 4 additions & 4 deletions providers/cnr/records.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type CNRRecord struct {
Host string
// FQDN is the Fully Qualified Domain Name. It is the combination of the host and the domain name. It always ends in a ".". FQDN is ignored in CreateRecord, specify via the Host field instead.
Fqdn string
// Type is one of the following: A, AAAA, ANAME, CNAME, MX, NS, SRV, or TXT.
// Type is one of the following: A, AAAA, ANAME, ALIAS, CNAME, MX, NS, SRV, or TXT.
Type string
// Answer is either the IP address for A or AAAA records; the target for ANAME, CNAME, MX, or NS records; the text for TXT records.
// For SRV records, answer has the following format: "{weight} {port} {target}" e.g. "1 5061 sip.example.org".
Expand Down Expand Up @@ -150,7 +150,7 @@ func toRecord(r *CNRRecord, origin string) *models.RecordConfig {
panic(fmt.Errorf("unparsable SRV record received from centralnic reseller API: %w", err))
}
}
default: // "A", "AAAA", "ANAME", "CNAME", "NS", "TXT", "CAA", "TLSA", "PTR"
default: // "A", "AAAA", "ANAME", "ALIAS", "CNAME", "NS", "TXT", "CAA", "TLSA", "PTR"
if err := rc.PopulateFromStringFunc(r.Type, r.Answer, r.Fqdn, txtutil.ParseQuoted); err != nil {
panic(fmt.Errorf("unparsable record received from centralnic reseller API: %w", err))
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func (n *CNRClient) getRecords(domain string) ([]*CNRRecord, error) {
priority, _ := strconv.ParseUint(data["PRIO"], 10, 32)

// Add dot to Answer if supported by the record type
pattern := `^CNAME|MX|NS|SRV|PTR$`
pattern := `^ALIAS|CNAME|MX|NS|SRV|PTR$`
re, err := regexp.Compile(pattern)
if err != nil {
return nil, fmt.Errorf("error compiling regex in getRecords: %w", err)
Expand Down Expand Up @@ -291,7 +291,7 @@ func (n *CNRClient) createRecordString(rc *models.RecordConfig, domain string) (
answer := ""

switch rc.Type { // #rtype_variations
case "A", "AAAA", "ANAME", "CNAME", "MX", "NS", "PTR":
case "A", "AAAA", "ANAME", "ALIAS", "CNAME", "MX", "NS", "PTR":
answer = rc.GetTargetField()
if domain == host {
host = host + "."
Expand Down

0 comments on commit a3d6c51

Please sign in to comment.