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

REFACTOR: Opinion: TXT records are one long string (#2631)

Co-authored-by: Costas Drogos <costas.drogos@gmail.com>
Co-authored-by: imlonghao <git@imlonghao.com>
Co-authored-by: Jeffrey Cafferata <jeffrey@jcid.nl>
Co-authored-by: Vincent Hagen <blackshadev@users.noreply.github.com>
This commit is contained in:
Tom Limoncelli
2023-12-04 17:45:25 -05:00
committed by GitHub
parent 88d26c3ea2
commit cbccbbeb8d
71 changed files with 882 additions and 747 deletions

View File

@ -306,7 +306,7 @@ func (g *gcloudProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, exis
}
for _, r := range dc.Records {
if keyForRec(r) == ck {
newRRs.Rrdatas = append(newRRs.Rrdatas, r.GetTargetCombined())
newRRs.Rrdatas = append(newRRs.Rrdatas, r.GetTargetCombinedFunc(txtutil.EncodeQuoted))
newRRs.Ttl = int64(r.TTL)
}
}
@ -403,13 +403,7 @@ func nativeToRecord(set *gdns.ResourceRecordSet, rec, origin string) (*models.Re
r.SetLabelFromFQDN(set.Name, origin)
r.TTL = uint32(set.Ttl)
rtype := set.Type
var err error
switch rtype {
case "TXT":
err = r.SetTargetTXTs(models.ParseQuotedTxt(rec))
default:
err = r.PopulateFromString(rtype, rec, origin)
}
err := r.PopulateFromStringFunc(rtype, rec, origin, txtutil.ParseQuoted)
if err != nil {
return nil, fmt.Errorf("unparsable record %q received from GCLOUD: %w", rtype, err)
}