mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
update dependencies (#1077)
* update dependencies ddns: update libdns to 1.0.0 * rename var
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user