mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-12 10:27:57 +08:00
CLOUDNS: ClouDNS NOT allow multiple TXT records with same name (#1098)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
parent
5cd9dc7b42
commit
875bb02c4e
2 changed files with 19 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
package cloudns
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/StackExchange/dnscontrol/v3/models"
|
||||
"github.com/StackExchange/dnscontrol/v3/pkg/recordaudit"
|
||||
)
|
||||
|
@ -29,5 +30,22 @@ func AuditRecords(records []*models.RecordConfig) error {
|
|||
}
|
||||
// Still needed as of 2021-03-11
|
||||
|
||||
if err := txtNoMultipleStrings(records); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ClouDNS NOT allow multiple TXT records with same name
|
||||
// But allow values longer the 255
|
||||
func txtNoMultipleStrings(records []*models.RecordConfig) error {
|
||||
for _, rc := range records {
|
||||
if rc.HasFormatIdenticalToTXT() { // TXT and similar:
|
||||
if len(rc.TxtStrings) > 1 {
|
||||
return fmt.Errorf("multiple strings in one txt")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
|
||||
"github.com/StackExchange/dnscontrol/v3/models"
|
||||
"github.com/StackExchange/dnscontrol/v3/pkg/diff"
|
||||
"github.com/StackExchange/dnscontrol/v3/pkg/txtutil"
|
||||
"github.com/StackExchange/dnscontrol/v3/providers"
|
||||
)
|
||||
|
||||
|
@ -55,7 +54,7 @@ var features = providers.DocumentationNotes{
|
|||
|
||||
func init() {
|
||||
fns := providers.DspFuncs{
|
||||
Initializer: NewCloudns,
|
||||
Initializer: NewCloudns,
|
||||
RecordAuditor: AuditRecords,
|
||||
}
|
||||
providers.RegisterDomainServiceProviderType("CLOUDNS", fns, features)
|
||||
|
@ -94,7 +93,6 @@ func (c *cloudnsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mode
|
|||
}
|
||||
// Normalize
|
||||
models.PostProcessRecords(existingRecords)
|
||||
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
|
||||
|
||||
// ClouDNS doesn't allow selecting an arbitrary TTL, only a set of predefined values https://asia.cloudns.net/wiki/article/188/
|
||||
// We need to make sure we don't change it every time if it is as close as it's going to get
|
||||
|
|
Loading…
Reference in a new issue