mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
NAMECHEAP: Add CAA support (#533)
This commit is contained in:
committed by
Tom Limoncelli
parent
ae3a730e64
commit
cae35a2c8f
@@ -29,7 +29,7 @@ type Namecheap struct {
|
|||||||
|
|
||||||
var features = providers.DocumentationNotes{
|
var features = providers.DocumentationNotes{
|
||||||
providers.CanUseAlias: providers.Cannot(),
|
providers.CanUseAlias: providers.Cannot(),
|
||||||
providers.CanUseCAA: providers.Cannot(),
|
providers.CanUseCAA: providers.Can(),
|
||||||
providers.CanUsePTR: providers.Cannot(),
|
providers.CanUsePTR: providers.Cannot(),
|
||||||
providers.CanUseSRV: providers.Cannot("The namecheap web console allows you to make SRV records, but their api does not let you read or set them"),
|
providers.CanUseSRV: providers.Cannot("The namecheap web console allows you to make SRV records, but their api does not let you read or set them"),
|
||||||
providers.CanUseTLSA: providers.Cannot(),
|
providers.CanUseTLSA: providers.Cannot(),
|
||||||
@@ -155,7 +155,14 @@ func (n *Namecheap) GetDomainCorrections(dc *models.DomainConfig) ([]*models.Cor
|
|||||||
Original: r,
|
Original: r,
|
||||||
}
|
}
|
||||||
rec.SetLabel(r.Name, dc.Name)
|
rec.SetLabel(r.Name, dc.Name)
|
||||||
rec.SetTarget(r.Address)
|
switch rtype := r.Type; rtype { // #rtype_variations
|
||||||
|
case "TXT":
|
||||||
|
rec.SetTargetTXT(r.Address)
|
||||||
|
case "CAA":
|
||||||
|
rec.SetTargetCAAString(r.Address)
|
||||||
|
default:
|
||||||
|
rec.SetTarget(r.Address)
|
||||||
|
}
|
||||||
actual = append(actual, rec)
|
actual = append(actual, rec)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,11 +210,19 @@ func (n *Namecheap) generateRecords(dc *models.DomainConfig) error {
|
|||||||
|
|
||||||
id := 1
|
id := 1
|
||||||
for _, r := range dc.Records {
|
for _, r := range dc.Records {
|
||||||
|
var value string
|
||||||
|
switch rtype := r.Type; rtype { // #rtype_variations
|
||||||
|
case "CAA":
|
||||||
|
value = r.GetTargetCombined()
|
||||||
|
default:
|
||||||
|
value = r.GetTargetField()
|
||||||
|
}
|
||||||
|
|
||||||
rec := nc.DomainDNSHost{
|
rec := nc.DomainDNSHost{
|
||||||
ID: id,
|
ID: id,
|
||||||
Name: r.GetLabel(),
|
Name: r.GetLabel(),
|
||||||
Type: r.Type,
|
Type: r.Type,
|
||||||
Address: r.GetTargetField(),
|
Address: value,
|
||||||
MXPref: int(r.MxPreference),
|
MXPref: int(r.MxPreference),
|
||||||
TTL: int(r.TTL),
|
TTL: int(r.TTL),
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user