Compare commits
2 Commits
bc1c3842ee
...
70ff03f233
Author | SHA1 | Date | |
---|---|---|---|
70ff03f233 | |||
581d6613cc |
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module go.balki.me/cloudflare-dns-cli
|
||||
|
||||
go 1.22.1
|
||||
go 1.22.2
|
||||
|
||||
require (
|
||||
github.com/libdns/cloudflare v0.1.1
|
||||
|
1
main.go
1
main.go
@ -36,6 +36,7 @@ func genRecord() (libdns.Record, error) {
|
||||
Type: "MX",
|
||||
Name: sub,
|
||||
Value: cname,
|
||||
Priority: 10,
|
||||
}, nil
|
||||
} else {
|
||||
return libdns.Record{
|
||||
|
10
vendor/github.com/libdns/cloudflare/models.go
generated
vendored
10
vendor/github.com/libdns/cloudflare/models.go
generated
vendored
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user