mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-04-05 08:54:09 -04:00
change(all): deprecate provider_ip config field
- change should not affect any existing configurations - change solves issues with dual stack updates (#767) - was unneeded and adds unneeded complexity
This commit is contained in:
@@ -28,8 +28,7 @@ type commonSettings struct {
|
||||
IPVersion string `json:"ip_version"`
|
||||
IPv6Suffix netip.Prefix `json:"ipv6_suffix,omitempty"`
|
||||
// Retro values for warnings
|
||||
IPMethod *string `json:"ip_method,omitempty"`
|
||||
Delay *uint64 `json:"delay,omitempty"`
|
||||
ProviderIP *bool `json:"provider_ip,omitempty"`
|
||||
}
|
||||
|
||||
// JSONProviders obtain the update settings from the JSON content,
|
||||
@@ -196,6 +195,13 @@ func makeSettingsFromObject(common commonSettings, rawSettings json.RawMessage,
|
||||
ipv6Suffix, ipVersion))
|
||||
}
|
||||
|
||||
if common.ProviderIP != nil {
|
||||
warning := fmt.Sprintf("for domain %s and ip version %s: "+
|
||||
`the field "provider_ip" is deprecated and no longer used`,
|
||||
domain, ipVersion)
|
||||
warnings = append(warnings, warning)
|
||||
}
|
||||
|
||||
providerName := models.Provider(common.Provider)
|
||||
providers = make([]provider.Provider, len(owners))
|
||||
for i, owner := range owners {
|
||||
|
||||
@@ -20,22 +20,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -48,13 +46,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -121,13 +118,10 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("host", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
if ip.Is6() {
|
||||
values.Set("myip6", ip.String())
|
||||
} else {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
if ip.Is6() {
|
||||
values.Set("myip6", ip.String())
|
||||
} else {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
@@ -185,7 +179,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
|
||||
newIP = ips[0]
|
||||
if !useProviderIP && ip.Compare(newIP) != 0 {
|
||||
if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -17,22 +17,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
var providerSpecificSettings struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
err = json.Unmarshal(data, &providerSpecificSettings)
|
||||
if err != nil {
|
||||
@@ -46,13 +44,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: providerSpecificSettings.Username,
|
||||
password: providerSpecificSettings.Password,
|
||||
useProviderIP: providerSpecificSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: providerSpecificSettings.Username,
|
||||
password: providerSpecificSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -118,10 +115,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("ip", ip.String())
|
||||
}
|
||||
values.Set("ip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -19,20 +19,18 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -45,12 +43,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -113,12 +110,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values := url.Values{}
|
||||
values.Set("hostname", p.BuildDomainName())
|
||||
values.Set("password", p.password)
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if useProviderIP {
|
||||
values.Set("ip", "auto")
|
||||
} else {
|
||||
values.Set("ip", ip.String())
|
||||
}
|
||||
values.Set("ip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -19,24 +19,22 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
dualStack bool
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
dualStack bool
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
DualStack bool `json:"dual_stack"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
DualStack bool `json:"dual_stack"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -49,14 +47,13 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
dualStack: extraSettings.DualStack,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
dualStack: extraSettings.DualStack,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -124,14 +121,11 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values.Set("user", p.username)
|
||||
values.Set("pwd", p.password)
|
||||
values.Set("host", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
ipKey := "ip"
|
||||
if p.dualStack && ip.Is6() { // ipv6 update for dual stack
|
||||
ipKey = "ip6"
|
||||
}
|
||||
values.Set(ipKey, ip.String())
|
||||
ipKey := "ip"
|
||||
if p.dualStack && ip.Is6() { // ipv6 update for dual stack
|
||||
ipKey = "ip6"
|
||||
}
|
||||
values.Set(ipKey, ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -19,20 +19,18 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Token string `json:"token"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Token string `json:"token"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -48,12 +46,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
token: extraSettings.Token,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
token: extraSettings.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -115,10 +112,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -20,22 +20,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -48,13 +46,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -119,10 +116,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
User: url.UserPassword(p.username, p.password),
|
||||
}
|
||||
values := url.Values{}
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
values.Set("wildcard", "NOCHG")
|
||||
if p.owner == "*" {
|
||||
values.Set("hostname", p.domain)
|
||||
@@ -186,7 +180,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
|
||||
newIP = ips[0]
|
||||
if !useProviderIP && ip.Compare(newIP) != 0 {
|
||||
if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -21,12 +21,11 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
}
|
||||
|
||||
const eTLD = "duckdns.org"
|
||||
@@ -52,8 +51,7 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
extraSettings := struct {
|
||||
Token string `json:"token"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Token string `json:"token"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -66,12 +64,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
token: extraSettings.Token,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
token: extraSettings.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -145,13 +142,10 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values.Set("verbose", "true")
|
||||
values.Set("domains", p.BuildDomainName())
|
||||
values.Set("token", p.token)
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
if ip.Is6() {
|
||||
values.Set("ipv6", ip.String())
|
||||
} else {
|
||||
values.Set("ip", ip.String())
|
||||
}
|
||||
if ip.Is6() {
|
||||
values.Set("ipv6", ip.String())
|
||||
} else {
|
||||
values.Set("ip", ip.String())
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
@@ -195,7 +189,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
return netip.Addr{}, fmt.Errorf("%w", errors.ErrReceivedNoIP)
|
||||
}
|
||||
newIP = ips[0]
|
||||
if !useProviderIP && newIP.Compare(ip) != 0 {
|
||||
if newIP.Compare(ip) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -19,24 +19,22 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
group string
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
group string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Group string `json:"group"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Group string `json:"group"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -53,14 +51,13 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
group: extraSettings.Group,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
group: extraSettings.Group,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -130,13 +127,10 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values.Set("location", p.group)
|
||||
hostname := utils.BuildDomainName(p.owner, p.domain)
|
||||
values.Set("hostname", hostname)
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
if ip.Is6() {
|
||||
values.Set("myipv6", ip.String())
|
||||
} else {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
if ip.Is6() {
|
||||
values.Set("myipv6", ip.String())
|
||||
} else {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
|
||||
@@ -17,20 +17,18 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Token string `json:"token"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Token string `json:"token"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -43,12 +41,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
token: extraSettings.Token,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
token: extraSettings.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -120,15 +117,10 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values := url.Values{}
|
||||
values.Set("token", p.token)
|
||||
values.Set("zone", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
ipValue := ip.String()
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if useProviderIP {
|
||||
ipValue = "auto"
|
||||
}
|
||||
if isIPv4 {
|
||||
values.Set("ipv4", ipValue)
|
||||
values.Set("ipv4", ip.String())
|
||||
} else {
|
||||
values.Set("ipv6", ipValue)
|
||||
values.Set("ipv6", ip.String())
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
|
||||
@@ -19,22 +19,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
token string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
token string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Token string `json:"token"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Token string `json:"token"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -47,13 +45,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
token: extraSettings.Token,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
token: extraSettings.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -119,10 +116,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
if p.owner == "*" {
|
||||
values.Set("wildcard", "ON")
|
||||
}
|
||||
|
||||
@@ -20,13 +20,12 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
const defaultDomain = "goip.de"
|
||||
@@ -52,9 +51,8 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -67,13 +65,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -149,11 +146,8 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values.Set("password", p.password)
|
||||
values.Set("shortResponse", "true")
|
||||
if ip.Is4() {
|
||||
if !p.useProviderIP {
|
||||
values.Set("ip", ip.String())
|
||||
}
|
||||
values.Set("ip", ip.String())
|
||||
} else {
|
||||
// IPv6 cannot be automatically detected
|
||||
values.Set("ip6", ip.String())
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
@@ -20,20 +20,18 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -46,12 +44,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -114,10 +111,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", fqdn)
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
@@ -161,7 +155,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
|
||||
newIP = ips[0]
|
||||
if !useProviderIP && ip.Compare(newIP) != 0 {
|
||||
if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -19,22 +19,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -47,13 +45,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -120,10 +117,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
@@ -166,7 +160,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
if err != nil {
|
||||
return netip.Addr{}, fmt.Errorf("%w: for response %q: %w",
|
||||
errors.ErrIPReceivedMalformed, ipString, err)
|
||||
} else if !useProviderIP && ip.Compare(newIP) != 0 {
|
||||
} else if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -20,17 +20,15 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -43,10 +41,9 @@ func New(data json.RawMessage, domain, owner string) (
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -117,9 +114,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values.Set("host", p.owner)
|
||||
values.Set("domain", p.domain)
|
||||
values.Set("password", p.password)
|
||||
if !p.useProviderIP {
|
||||
values.Set("ip", ip.String())
|
||||
}
|
||||
values.Set("ip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
@@ -168,7 +163,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
newIP, err = netip.ParseAddr(parsedXML.IP)
|
||||
if err != nil {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %w", errors.ErrIPReceivedMalformed, err)
|
||||
} else if !p.useProviderIP && ip.Compare(newIP) != 0 {
|
||||
} else if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -17,20 +17,18 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
key string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
key string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Key string `json:"key"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Key string `json:"key"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -43,12 +41,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
key: extraSettings.Key,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
key: extraSettings.Key,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -111,15 +108,10 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
values.Set("h", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
values.Set("k", p.key)
|
||||
updatingIP6 := ip.Is6()
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if useProviderIP {
|
||||
values.Set("auto", "")
|
||||
if updatingIP6 {
|
||||
values.Set("aaaa", ip.String())
|
||||
} else {
|
||||
if updatingIP6 {
|
||||
values.Set("aaaa", ip.String())
|
||||
} else {
|
||||
values.Set("a", ip.String())
|
||||
}
|
||||
values.Set("a", ip.String())
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
@@ -161,7 +153,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
newIP, err = netip.ParseAddr(ipString)
|
||||
if err != nil {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %w", errors.ErrIPReceivedMalformed, err)
|
||||
} else if !useProviderIP && ip.Compare(newIP) != 0 {
|
||||
} else if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -20,47 +20,38 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if ipVersion == ipversion.IP6 {
|
||||
// Thanks to @NightFurySL2001
|
||||
// See https://github.com/qdm12/ddns-updater/discussions/750
|
||||
extraSettings.UseProviderIP = false
|
||||
}
|
||||
|
||||
err = validateSettings(domain, owner, extraSettings.Username, extraSettings.Password)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("validating provider specific settings: %w", err)
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -130,13 +121,10 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
// See https://help.dyn.com/remote-access-api/perform-update/ stating:
|
||||
// This authentication method supports both IPv6 and IPv4 addresses.
|
||||
// Use commas to separate multiple IP addresses in the myip field.
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
// See https://help.dyn.com/remote-access-api/perform-update/ stating:
|
||||
// This authentication method supports both IPv6 and IPv4 addresses.
|
||||
// Use commas to separate multiple IP addresses in the myip field.
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
@@ -190,15 +178,11 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
|
||||
if len(ips) == 0 {
|
||||
if useProviderIP {
|
||||
// No returned ip address from noip server
|
||||
return ip, nil
|
||||
}
|
||||
return netip.Addr{}, fmt.Errorf("%w", errors.ErrReceivedNoIP)
|
||||
}
|
||||
|
||||
newIP = ips[0]
|
||||
if !useProviderIP && ip.Compare(newIP) != 0 {
|
||||
if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -19,21 +19,19 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -46,12 +44,11 @@ func New(data json.RawMessage, domain string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -117,9 +114,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
|
||||
values := url.Values{}
|
||||
values.Set("hostname", p.domain)
|
||||
if !p.useProviderIP || (ip.Is6() && p.ipv6Suffix.IsValid()) {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
if err != nil {
|
||||
@@ -146,7 +141,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
newIP, err = netip.ParseAddr(ip.String())
|
||||
if err != nil {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %w", errors.ErrIPReceivedMalformed, err)
|
||||
} else if !p.useProviderIP && ip.Compare(newIP) != 0 {
|
||||
} else if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
@@ -155,7 +150,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
newIP, err = netip.ParseAddr(ip.String())
|
||||
if err != nil {
|
||||
return netip.Addr{}, fmt.Errorf("%w: in response %q", errors.ErrReceivedNoResult, s)
|
||||
} else if !p.useProviderIP && ip.Compare(newIP) != 0 {
|
||||
} else if ip.Compare(newIP) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -19,22 +19,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -47,13 +45,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -120,10 +117,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
@@ -155,7 +149,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
newIP, err = netip.ParseAddr(responseIPString)
|
||||
if err != nil {
|
||||
return netip.Addr{}, fmt.Errorf("%w: %w", errors.ErrIPReceivedMalformed, err)
|
||||
} else if !useProviderIP && newIP.Compare(ip) != 0 {
|
||||
} else if newIP.Compare(ip) != 0 {
|
||||
return netip.Addr{}, fmt.Errorf("%w: sent ip %s to update but received %s",
|
||||
errors.ErrIPReceivedMismatch, ip, newIP)
|
||||
}
|
||||
|
||||
@@ -20,34 +20,32 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
mode string
|
||||
apiURL *url.URL
|
||||
appKey string
|
||||
appSecret string
|
||||
consumerKey string
|
||||
timeNow func() time.Time
|
||||
serverDelta time.Duration
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
mode string
|
||||
apiURL *url.URL
|
||||
appKey string
|
||||
appSecret string
|
||||
consumerKey string
|
||||
timeNow func() time.Time
|
||||
serverDelta time.Duration
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Mode string `json:"mode"`
|
||||
APIEndpoint string `json:"api_endpoint"`
|
||||
AppKey string `json:"app_key"`
|
||||
AppSecret string `json:"app_secret"`
|
||||
ConsumerKey string `json:"consumer_key"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Mode string `json:"mode"`
|
||||
APIEndpoint string `json:"api_endpoint"`
|
||||
AppKey string `json:"app_key"`
|
||||
AppSecret string `json:"app_secret"`
|
||||
ConsumerKey string `json:"consumer_key"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -66,19 +64,18 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
mode: extraSettings.Mode,
|
||||
apiURL: apiURL,
|
||||
appKey: extraSettings.AppKey,
|
||||
appSecret: extraSettings.AppSecret,
|
||||
consumerKey: extraSettings.ConsumerKey,
|
||||
timeNow: time.Now,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
mode: extraSettings.Mode,
|
||||
apiURL: apiURL,
|
||||
appKey: extraSettings.AppKey,
|
||||
appSecret: extraSettings.AppSecret,
|
||||
consumerKey: extraSettings.ConsumerKey,
|
||||
timeNow: time.Now,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -159,10 +156,7 @@ func (p *Provider) updateWithDynHost(ctx context.Context, client *http.Client,
|
||||
values := url.Values{}
|
||||
values.Set("system", "dyndns")
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -19,22 +19,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -47,13 +45,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -120,10 +117,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -19,14 +19,13 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
ttl uint32
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
password string
|
||||
ttl uint32
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string, ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
@@ -37,10 +36,9 @@ func New(data json.RawMessage, domain, owner string, ipVersion ipversion.IPVersi
|
||||
}
|
||||
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -53,14 +51,13 @@ func New(data json.RawMessage, domain, owner string, ipVersion ipversion.IPVersi
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
ttl: extraSettings.TTL,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
password: extraSettings.Password,
|
||||
ttl: extraSettings.TTL,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -19,24 +19,22 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
user string
|
||||
password string
|
||||
token string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
user string
|
||||
password string
|
||||
token string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
User string `json:"user"`
|
||||
Password string `json:"password"`
|
||||
Token string `json:"token"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
User string `json:"user"`
|
||||
Password string `json:"password"`
|
||||
Token string `json:"token"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -49,14 +47,13 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
user: extraSettings.User,
|
||||
password: extraSettings.Password,
|
||||
token: extraSettings.Token,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
user: extraSettings.User,
|
||||
password: extraSettings.Password,
|
||||
token: extraSettings.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -129,11 +126,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
hostname := utils.BuildURLQueryHostname(p.owner, p.domain)
|
||||
values := url.Values{}
|
||||
values.Set("hostname", hostname)
|
||||
if p.useProviderIP {
|
||||
values.Set("myip", "10.0.0.1")
|
||||
} else {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
if p.token != "" {
|
||||
values.Set("user", hostname)
|
||||
values.Set("pass", p.token)
|
||||
|
||||
@@ -19,20 +19,18 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -45,12 +43,11 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -115,10 +112,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -19,22 +19,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
email string
|
||||
password string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
email string
|
||||
password string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -47,13 +45,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
email: extraSettings.Email,
|
||||
password: extraSettings.Password,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
email: extraSettings.Email,
|
||||
password: extraSettings.Password,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -112,14 +109,9 @@ func (p *Provider) HTML() models.HTMLRow {
|
||||
}
|
||||
|
||||
func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Addr) (newIP netip.Addr, err error) {
|
||||
host := "dyndns.variomedia.de"
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if useProviderIP {
|
||||
if ip.Is6() {
|
||||
host = "dyndns6.variomedia.de"
|
||||
} else {
|
||||
host = "dyndns4.variomedia.de"
|
||||
}
|
||||
host := "dyndns4.variomedia.de"
|
||||
if ip.Is6() {
|
||||
host = "dyndns6.variomedia.de"
|
||||
}
|
||||
|
||||
u := url.URL{
|
||||
@@ -130,9 +122,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
if !p.useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
request, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
|
||||
|
||||
@@ -20,22 +20,20 @@ import (
|
||||
)
|
||||
|
||||
type Provider struct {
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
token string
|
||||
useProviderIP bool
|
||||
domain string
|
||||
owner string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
username string
|
||||
token string
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, owner string,
|
||||
ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
p *Provider, err error) {
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Token string `json:"token"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
Username string `json:"username"`
|
||||
Token string `json:"token"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -48,13 +46,12 @@ func New(data json.RawMessage, domain, owner string,
|
||||
}
|
||||
|
||||
return &Provider{
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
token: extraSettings.Token,
|
||||
useProviderIP: extraSettings.UseProviderIP,
|
||||
domain: domain,
|
||||
owner: owner,
|
||||
ipVersion: ipVersion,
|
||||
ipv6Suffix: ipv6Suffix,
|
||||
username: extraSettings.Username,
|
||||
token: extraSettings.Token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -120,10 +117,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
useProviderIP := p.useProviderIP && (ip.Is4() || !p.ipv6Suffix.IsValid())
|
||||
if !useProviderIP {
|
||||
values.Set("myip", ip.String())
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
if p.owner == "*" {
|
||||
values.Set("wildcard", "ON")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user