Skip to content

Commit e635b19

Browse files
authored
fix(duckdns): support for ipv6 (#542)
* fix `ip6` -> `ipv6` url parameter key name * fix ipv6 response handling
1 parent c7c5468 commit e635b19

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/provider/providers/duckdns/provider.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
109109
values.Set("token", p.token)
110110
if !p.useProviderIP {
111111
if ip.Is6() {
112-
values.Set("ip6", ip.String())
112+
values.Set("ipv6", ip.String())
113113
} else {
114114
values.Set("ip", ip.String())
115115
}
@@ -146,7 +146,12 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
146146
case s[0:minChars] == "KO":
147147
return netip.Addr{}, fmt.Errorf("%w", errors.ErrAuth)
148148
case s[0:minChars] == "OK":
149-
ips := ipextract.IPv4(s)
149+
var ips []netip.Addr
150+
if ip.Is6() {
151+
ips = ipextract.IPv6(s)
152+
} else {
153+
ips = ipextract.IPv4(s)
154+
}
150155
if len(ips) == 0 {
151156
return netip.Addr{}, fmt.Errorf("%w", errors.ErrReceivedNoIP)
152157
}

0 commit comments

Comments
 (0)