mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-11 01:47:53 +08:00
CLOUDFLAREAPI: Support TXTMulti and empty TXT targets (#978)
* CLOUDFLAREAPI: Add TXTMulti support * CLOUDFLAREAPI: Support TXTMulti and empty TXT strings
This commit is contained in:
parent
12a3354c0c
commit
096458d91c
3 changed files with 12 additions and 1 deletions
|
@ -698,7 +698,7 @@ func makeTests(t *testing.T) []*TestGroup {
|
|||
),
|
||||
|
||||
testgroup("empty TXT",
|
||||
not("CLOUDFLAREAPI", "HETZNER", "HEXONET", "INWX", "NETCUP"),
|
||||
not("HETZNER", "HEXONET", "INWX", "NETCUP"),
|
||||
tc("TXT with empty str", txt("foo1", "")),
|
||||
// https://github.com/StackExchange/dnscontrol/issues/598
|
||||
// We decided that permitting the TXT target to be an empty
|
||||
|
|
|
@ -45,6 +45,7 @@ var features = providers.DocumentationNotes{
|
|||
providers.CanUseTLSA: providers.Can(),
|
||||
providers.CanUseSSHFP: providers.Can(),
|
||||
providers.CanUseDS: providers.Can(),
|
||||
providers.CanUseTXTMulti: providers.Can(),
|
||||
providers.DocCreateDomains: providers.Can(),
|
||||
providers.DocDualHost: providers.Cannot("Cloudflare will not work well in situations where it is not the only DNS server"),
|
||||
providers.DocOfficiallySupported: providers.Can(),
|
||||
|
|
|
@ -194,6 +194,11 @@ func (c *cloudflareProvider) createRec(rec *models.RecordConfig, domainID string
|
|||
if rec.Type == "MX" {
|
||||
prio = fmt.Sprintf(" %d ", rec.MxPreference)
|
||||
}
|
||||
if rec.Type == "TXT" {
|
||||
if len(rec.TxtStrings) > 1 {
|
||||
content = `"` + strings.Join(rec.TxtStrings, `" "`) + `"`
|
||||
}
|
||||
}
|
||||
if rec.Type == "DS" {
|
||||
content = fmt.Sprintf("%d %d %d %s", rec.DsKeyTag, rec.DsAlgorithm, rec.DsDigestType, rec.DsDigest)
|
||||
}
|
||||
|
@ -272,6 +277,11 @@ func (c *cloudflareProvider) modifyRecord(domainID, recID string, proxied bool,
|
|||
TTL: rec.TTL,
|
||||
Data: nil,
|
||||
}
|
||||
if rec.Type == "TXT" {
|
||||
if len(rec.TxtStrings) > 1 {
|
||||
r.Content = `"` + strings.Join(rec.TxtStrings, `" "`) + `"`
|
||||
}
|
||||
}
|
||||
if rec.Type == "SRV" {
|
||||
r.Data = cfSrvData(rec)
|
||||
r.Name = rec.GetLabelFQDN()
|
||||
|
|
Loading…
Reference in a new issue