mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-05-03 06:22:05 -04:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55962ebbe0 | ||
|
|
bf9f294614 | ||
|
|
f180b2878c | ||
|
|
98d601d444 | ||
|
|
ebcf24a19a | ||
|
|
012f58d0f7 |
@@ -108,10 +108,17 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
Scheme: "https",
|
||||
User: url.UserPassword(p.BuildDomainName(), p.token),
|
||||
Host: "update.dedyn.io",
|
||||
Path: "/nic/update",
|
||||
Path: "",
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("hostname", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
if ip.Is6() {
|
||||
values.Set("myipv6", ip.String())
|
||||
values.Set("myipv4", "preserve")
|
||||
} else {
|
||||
values.Set("myipv4", ip.String())
|
||||
values.Set("myipv6", "preserve")
|
||||
}
|
||||
values.Set("myip", ip.String())
|
||||
u.RawQuery = values.Encode()
|
||||
|
||||
|
||||
@@ -119,11 +119,11 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
Host: "dondns.dondominio.com",
|
||||
Path: "/json/",
|
||||
RawQuery: url.Values{
|
||||
"user": {p.username},
|
||||
"apikey": {p.key},
|
||||
"host": {utils.BuildURLQueryHostname(p.owner, p.domain)},
|
||||
"ip": {ip.String()},
|
||||
"lang": {"en"},
|
||||
"user": {p.username},
|
||||
"password": {p.key},
|
||||
"host": {utils.BuildURLQueryHostname(p.owner, p.domain)},
|
||||
"ip": {ip.String()},
|
||||
"lang": {"en"},
|
||||
}.Encode(),
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/qdm12/ddns-updater/internal/provider/errors"
|
||||
@@ -45,7 +45,7 @@ func (p *Provider) get(ctx context.Context, client *http.Client,
|
||||
u := url.URL{
|
||||
Scheme: "https",
|
||||
Host: "api.hosting.ionos.com",
|
||||
Path: filepath.Join("/dns/v1/", subPath),
|
||||
Path: path.Join("/dns/v1/", subPath),
|
||||
RawQuery: queryParams.Encode(),
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
u := url.URL{
|
||||
Scheme: "https",
|
||||
Host: "njal.la",
|
||||
Path: "/update",
|
||||
Path: "/update/",
|
||||
}
|
||||
values := url.Values{}
|
||||
values.Set("h", utils.BuildURLQueryHostname(p.owner, p.domain))
|
||||
|
||||
@@ -142,7 +142,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
Path: "/2013-04-01/hostedzone/" + p.zoneID + "/rrset",
|
||||
}
|
||||
|
||||
changeRRSetRequest := newChangeRRSetRequest(p.BuildDomainName(), p.ttl, ip)
|
||||
changeRRSetRequest := newChangeRRSetRequest(utils.BuildURLQueryHostname(p.owner, p.domain), p.ttl, ip)
|
||||
|
||||
// Note the AWS API does not accept JSON for this endpoint
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
|
||||
@@ -2,6 +2,7 @@ package update
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"strconv"
|
||||
@@ -65,6 +66,7 @@ func (s *Service) lookupIPsResilient(ctx context.Context, hostname string, tries
|
||||
lookupCtx, cancel := context.WithCancel(ctx)
|
||||
for _, network := range networks {
|
||||
go func(ctx context.Context, network string, results chan<- result) {
|
||||
errs := make([]error, 0, tries)
|
||||
for range tries {
|
||||
ips, err := s.resolver.LookupNetIP(ctx, network, hostname)
|
||||
if err != nil {
|
||||
@@ -72,11 +74,16 @@ func (s *Service) lookupIPsResilient(ctx context.Context, hostname string, tries
|
||||
results <- result{network: network} // no IP address for this network
|
||||
return
|
||||
}
|
||||
errs = append(errs, err)
|
||||
continue // retry
|
||||
}
|
||||
results <- result{network: network, ips: ips, err: err}
|
||||
return
|
||||
}
|
||||
results <- result{
|
||||
network: network,
|
||||
err: fmt.Errorf("ip look up failed after %d tries: %w", tries, errors.Join(errs...)),
|
||||
}
|
||||
}(lookupCtx, network, results)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user