libdns/cloudflare: Add Priority to MX records

This commit is contained in:
Balakrishnan Balasubramanian 2024-04-22 23:12:47 -04:00
parent bc1c3842ee
commit 581d6613cc

View File

@ -62,6 +62,7 @@ type cfDNSRecord struct {
ZoneName string `json:"zone_name,omitempty"`
CreatedOn time.Time `json:"created_on,omitempty"`
ModifiedOn time.Time `json:"modified_on,omitempty"`
Priority uint `json:"priority,omitempty"`
Data struct {
// LOC
LatDegrees int `json:"lat_degrees,omitempty"`
@ -122,13 +123,17 @@ func (r cfDNSRecord) libdnsRecord(zone string) libdns.Record {
}
return srv.ToRecord()
}
return libdns.Record{
out := libdns.Record{
Type: r.Type,
Name: libdns.RelativeName(r.Name, zone),
Value: r.Content,
TTL: time.Duration(r.TTL) * time.Second,
ID: r.ID,
}
if r.Type == "MX" {
out.Priority = r.Priority
}
return out
}
func cloudflareRecord(r libdns.Record) (cfDNSRecord, error) {
@ -152,6 +157,9 @@ func cloudflareRecord(r libdns.Record) (cfDNSRecord, error) {
} else {
rec.Name = r.Name
rec.Content = r.Value
if r.Type == "MX" {
rec.Priority = r.Priority
}
}
return rec, nil
}