ddns: support provider hurricane electric (#1036)

This commit is contained in:
UUBulb
2025-03-19 21:52:16 +08:00
committed by GitHub
parent 38c2374bad
commit 5c252f5e43
6 changed files with 15 additions and 4 deletions

View File

@@ -239,7 +239,7 @@ func (s *NezhaHandler) ReportGeoIP(c context.Context, r *pb.GeoIP) (*pb.GeoIP, e
ipv6 := geoip.IP.IPv6Addr
dnsServers := strings.Split(singleton.Conf.DNSServers, ",")
ctx := context.WithValue(context.Background(), ddns.DNSServerKey{}, utils.IfOr(len(dnsServers) > 0, dnsServers, utils.DNSServers))
ctx := context.WithValue(context.Background(), ddns.DNSServerKey{}, utils.IfOr(dnsServers[0] != "", dnsServers, utils.DNSServers))
providers, err := singleton.DDNSShared.GetDDNSProvidersFromProfiles(server.DDNSProfiles, &model.IP{IPv4Addr: ipv4, IPv6Addr: ipv6})
if err == nil {

View File

@@ -6,6 +6,7 @@ import (
"slices"
"github.com/libdns/cloudflare"
"github.com/libdns/he"
tencentcloud "github.com/nezhahq/libdns-tencentcloud"
"github.com/nezhahq/nezha/model"
@@ -85,6 +86,9 @@ func (c *DDNSClass) GetDDNSProvidersFromProfiles(profileId []uint64, ip *model.I
case model.ProviderTencentCloud:
provider.Setter = &tencentcloud.Provider{SecretId: profile.AccessID, SecretKey: profile.AccessSecret}
providers = append(providers, provider)
case model.ProviderHE:
provider.Setter = &he.Provider{APIKey: profile.AccessSecret}
providers = append(providers, provider)
default:
return nil, fmt.Errorf("无法找到配置的DDNS提供者 %s", profile.Provider)
}