Fix DDNS bugs and split up ddns module (#326)

* fix: webhook retry logic
fix: adjust record type based on ipv4 ipv6
refract: move ddns providers to a new module

* refract: move ddns module to pkg/
This commit is contained in:
Darc Z
2024-02-26 11:49:28 +08:00
committed by GitHub
parent 5e528c42c7
commit cf9d9bd248
7 changed files with 327 additions and 268 deletions

View File

@@ -3,6 +3,7 @@ package rpc
import (
"context"
"fmt"
"github.com/naiba/nezha/pkg/ddns"
"github.com/naiba/nezha/pkg/utils"
"log"
"time"
@@ -125,7 +126,7 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece
if err == nil && serverDomain != "" {
ipv4, ipv6, _ := utils.SplitIPAddr(host.IP)
maxRetries := int(singleton.Conf.DDNS.MaxRetries)
config := &singleton.DDNSDomainConfig{
config := &ddns.DomainConfig{
EnableIPv4: true,
EnableIpv6: true,
FullDomain: serverDomain,