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

DNSimple: Adding SRV, CAA, and ALIAS suppport (#243)

* dnsimple ALIAS

* caa working

* srv

* gen
This commit is contained in:
Craig Peterson
2017-10-18 15:51:44 -04:00
committed by GitHub
parent 2c5f4c88ea
commit e548b8f059
2 changed files with 29 additions and 8 deletions

View File

@@ -158,7 +158,9 @@
<i class="fa has-tooltip fa-check text-success" aria-hidden="true"></i> <i class="fa has-tooltip fa-check text-success" aria-hidden="true"></i>
</td> </td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td class="danger"> <td class="danger">
@@ -190,7 +192,9 @@
<td class="success"> <td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i> <i class="fa fa-check text-success" aria-hidden="true"></i>
</td> </td>
<td><i class="fa fa-minus dim"></i></td> <td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
<td class="success"> <td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i> <i class="fa fa-check text-success" aria-hidden="true"></i>
</td> </td>
@@ -258,7 +262,9 @@
</td> </td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i>
</td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td class="success"> <td class="success">
<i class="fa fa-check text-success" aria-hidden="true"></i> <i class="fa fa-check text-success" aria-hidden="true"></i>
@@ -284,7 +290,9 @@
</td> </td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td class="danger">
<i class="fa fa-times text-danger" aria-hidden="true"></i>
</td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td><i class="fa fa-minus dim"></i></td> <td><i class="fa fa-minus dim"></i></td>
<td class="danger"> <td class="danger">

View File

@@ -19,11 +19,12 @@ var docNotes = providers.DocumentationNotes{
providers.DocDualHost: providers.Cannot("DNSimple does not allow sufficient control over the apex NS records"), providers.DocDualHost: providers.Cannot("DNSimple does not allow sufficient control over the apex NS records"),
providers.DocCreateDomains: providers.Cannot(), providers.DocCreateDomains: providers.Cannot(),
providers.DocOfficiallySupported: providers.Cannot(), providers.DocOfficiallySupported: providers.Cannot(),
providers.CanUseTLSA: providers.Cannot(),
} }
func init() { func init() {
providers.RegisterRegistrarType("DNSIMPLE", newReg) providers.RegisterRegistrarType("DNSIMPLE", newReg)
providers.RegisterDomainServiceProviderType("DNSIMPLE", newDsp, providers.CanUsePTR, docNotes) providers.RegisterDomainServiceProviderType("DNSIMPLE", newDsp, providers.CanUsePTR, providers.CanUseAlias, providers.CanUseCAA, providers.CanUseSRV, docNotes)
} }
const stateRegistered = "registered" const stateRegistered = "registered"
@@ -61,9 +62,14 @@ func (c *DnsimpleApi) GetDomainCorrections(dc *models.DomainConfig) ([]*models.C
if r.Name == "" { if r.Name == "" {
r.Name = "@" r.Name = "@"
} }
if r.Type == "CNAME" || r.Type == "MX" { if r.Type == "CNAME" || r.Type == "MX" || r.Type == "ALIAS" || r.Type == "SRV" {
r.Content += "." r.Content += "."
} }
// dnsimple adds these odd txt records that mirror the alias records.
// they seem to manage them on deletes and things, so we'll just pretend they don't exist
if r.Type == "TXT" && strings.HasPrefix(r.Content, "ALIAS for ") {
continue
}
rec := &models.RecordConfig{ rec := &models.RecordConfig{
NameFQDN: dnsutil.AddOrigin(r.Name, dc.Name), NameFQDN: dnsutil.AddOrigin(r.Name, dc.Name),
Type: r.Type, Type: r.Type,
@@ -72,9 +78,18 @@ func (c *DnsimpleApi) GetDomainCorrections(dc *models.DomainConfig) ([]*models.C
MxPreference: uint16(r.Priority), MxPreference: uint16(r.Priority),
Original: r, Original: r,
} }
if r.Type == "CAA" || r.Type == "SRV" {
rec.CombinedTarget = true
}
actual = append(actual, rec) actual = append(actual, rec)
} }
removeOtherNS(dc) removeOtherNS(dc)
dc.Filter(func(r *models.RecordConfig) bool {
if r.Type == "CAA" || r.Type == "SRV" {
r.MergeToTarget()
}
return true
})
differ := diff.New(dc) differ := diff.New(dc)
_, create, delete, modify := differ.IncrementalDiff(actual) _, create, delete, modify := differ.IncrementalDiff(actual)
@@ -246,7 +261,6 @@ func (c *DnsimpleApi) createRecordFunc(rc *models.RecordConfig, domainName strin
if err != nil { if err != nil {
return err return err
} }
record := dnsimpleapi.ZoneRecord{ record := dnsimpleapi.ZoneRecord{
Name: dnsutil.TrimDomainName(rc.NameFQDN, domainName), Name: dnsutil.TrimDomainName(rc.NameFQDN, domainName),
Type: rc.Type, Type: rc.Type,
@@ -254,7 +268,6 @@ func (c *DnsimpleApi) createRecordFunc(rc *models.RecordConfig, domainName strin
TTL: int(rc.TTL), TTL: int(rc.TTL),
Priority: int(rc.MxPreference), Priority: int(rc.MxPreference),
} }
_, err = client.Zones.CreateRecord(accountId, domainName, record) _, err = client.Zones.CreateRecord(accountId, domainName, record)
if err != nil { if err != nil {
return err return err