Fixed MX records on NS1 (#783)

This commit is contained in:
Max Ratmeyer 2020-07-14 08:33:21 -04:00 committed by GitHub
parent df69016cd1
commit 644ba70e87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,7 +133,9 @@ func buildRecord(recs models.Records, domain string, id string) *dns.Record {
Zone: domain,
}
for _, r := range recs {
if r.Type == "TXT" {
if r.Type == "MX" {
rec.AddAnswer(&dns.Answer{Rdata: strings.Split(fmt.Sprintf("%d %v", r.MxPreference, r.GetTargetField()), " ")})
} else if r.Type == "TXT" {
rec.AddAnswer(&dns.Answer{Rdata: r.TxtStrings})
} else if r.Type == "SRV" {
rec.AddAnswer(&dns.Answer{Rdata: strings.Split(fmt.Sprintf("%d %d %d %v", r.SrvPriority, r.SrvWeight, r.SrvPort, r.GetTargetField()), " ")})