update dependencies (#1077)

* update dependencies

ddns: update libdns to 1.0.0

* rename var
This commit is contained in:
UUBulb
2025-05-02 00:25:23 +08:00
committed by GitHub
parent 4871211f93
commit bcc4104bde
5 changed files with 125 additions and 117 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"net/netip"
"time"
"github.com/libdns/libdns"
@@ -70,13 +71,17 @@ func (provider *Provider) updateDomain(ctx context.Context, domain string) error
}
func (provider *Provider) addDomainRecord(ctx context.Context, recType, addr string) error {
_, err := provider.Setter.SetRecords(ctx, provider.zone,
netipAddr, err := netip.ParseAddr(addr)
if err != nil {
return fmt.Errorf("parse error: %v", err)
}
_, err = provider.Setter.SetRecords(ctx, provider.zone,
[]libdns.Record{
{
Type: recType,
Name: provider.prefix,
Value: addr,
TTL: time.Minute,
libdns.Address{
Name: provider.prefix,
IP: netipAddr,
TTL: time.Minute,
},
})
return err