fix: dns update comment

This commit is contained in:
chinhwajie
2025-02-17 15:28:23 +08:00
parent 1b010f1f25
commit 6eef66d849
2 changed files with 3 additions and 1 deletions

BIN
bitsrun Executable file

Binary file not shown.

View File

@@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"time"
"github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go"
) )
@@ -64,6 +65,7 @@ func (a DnsProvider) SetDomainRecord(domain, ip string) error {
// update record // update record
record := dnsRecords[0] record := dnsRecords[0]
comment := fmt.Sprintf("updates on %s by BitSrunLoginGo", time.Now().Format("2006-01-02 15:04:05"))
record, err = a.Api.UpdateDNSRecord(context.TODO(), &rc, cloudflare.UpdateDNSRecordParams{ record, err = a.Api.UpdateDNSRecord(context.TODO(), &rc, cloudflare.UpdateDNSRecordParams{
ID: record.ID, ID: record.ID,
Name: record.Name, Name: record.Name,
@@ -71,7 +73,7 @@ func (a DnsProvider) SetDomainRecord(domain, ip string) error {
Content: ip, Content: ip,
TTL: record.TTL, TTL: record.TTL,
Proxied: record.Proxied, Proxied: record.Proxied,
Comment: &record.Comment, Comment: &comment,
}) })
if err != nil { if err != nil {