Compare commits

..

No commits in common. "main" and "v0.2.0" have entirely different histories.
main ... v0.2.0

3 changed files with 5 additions and 14 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module go.balki.me/cloudflare-dns-cli
go 1.22.2
go 1.22.1
require (
github.com/libdns/cloudflare v0.1.1

View File

@ -33,10 +33,9 @@ func genRecord() (libdns.Record, error) {
case cname != "":
if mx {
return libdns.Record{
Type: "MX",
Name: sub,
Value: cname,
Priority: 10,
Type: "MX",
Name: sub,
Value: cname,
}, nil
} else {
return libdns.Record{

View File

@ -62,7 +62,6 @@ 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"`
@ -123,17 +122,13 @@ func (r cfDNSRecord) libdnsRecord(zone string) libdns.Record {
}
return srv.ToRecord()
}
out := libdns.Record{
return 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) {
@ -157,9 +152,6 @@ 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
}