mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-03-31 06:24:00 -04:00
chore(providers): change ttl type to uint32
This commit is contained in:
@@ -31,7 +31,7 @@ type Provider struct {
|
||||
userServiceKey string
|
||||
zoneIdentifier string
|
||||
proxied bool
|
||||
ttl uint
|
||||
ttl uint32
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, host string,
|
||||
@@ -44,7 +44,7 @@ func New(data json.RawMessage, domain, host string,
|
||||
UserServiceKey string `json:"user_service_key"`
|
||||
ZoneIdentifier string `json:"zone_identifier"`
|
||||
Proxied bool `json:"proxied"`
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -243,7 +243,7 @@ func (p *Provider) createRecord(ctx context.Context, client *http.Client, ip net
|
||||
Name string `json:"name"` // DNS record name i.e. example.com
|
||||
Content string `json:"content"` // ip address
|
||||
Proxied bool `json:"proxied"` // whether the record is receiving the performance and security benefits of Cloudflare
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{
|
||||
Type: recordType,
|
||||
Name: utils.BuildURLQueryHostname(p.host, p.domain),
|
||||
@@ -335,7 +335,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
Name string `json:"name"` // DNS record name i.e. example.com
|
||||
Content string `json:"content"` // ip address
|
||||
Proxied bool `json:"proxied"` // whether the record is receiving the performance and security benefits of Cloudflare
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{
|
||||
Type: recordType,
|
||||
Name: utils.BuildURLQueryHostname(p.host, p.domain),
|
||||
|
||||
@@ -22,7 +22,7 @@ type Provider struct {
|
||||
host string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
ttl int
|
||||
ttl uint32
|
||||
// Authentication, either use the personal access token
|
||||
// or the deprecated API key.
|
||||
// See https://api.gandi.net/docs/authentication/
|
||||
@@ -38,7 +38,7 @@ func New(data json.RawMessage, domain, host string,
|
||||
extraSettings := struct {
|
||||
PersonalAccessToken string `json:"personal_access_token"`
|
||||
APIKey string `json:"key"`
|
||||
TTL int `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
@@ -118,14 +118,14 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
encoder := json.NewEncoder(buffer)
|
||||
const defaultTTL = 3600
|
||||
const defaultTTL uint32 = 3600
|
||||
ttl := defaultTTL
|
||||
if p.ttl != 0 {
|
||||
ttl = p.ttl
|
||||
}
|
||||
requestData := struct {
|
||||
Values [1]string `json:"rrset_values"`
|
||||
TTL int `json:"rrset_ttl"`
|
||||
TTL uint32 `json:"rrset_ttl"`
|
||||
}{
|
||||
Values: [1]string{ip.Unmap().String()},
|
||||
TTL: ttl,
|
||||
|
||||
@@ -19,7 +19,7 @@ type recordResourceSet struct {
|
||||
// Rrdatas, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1)
|
||||
Rrdatas []string `json:"rrdatas,omitempty"`
|
||||
// TTL is the number of seconds that this RRSet can be cached by resolvers.
|
||||
TTL int64 `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
// Type is the identifier of a record type. For example A or AAAA.
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func (p *Provider) createRecord(ctx context.Context, client *http.Client, ip net
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
ZoneIdentifier string `json:"zone_id"`
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{
|
||||
Type: recordType,
|
||||
Name: p.host,
|
||||
|
||||
@@ -22,7 +22,7 @@ type Provider struct {
|
||||
ipv6Suffix netip.Prefix
|
||||
token string
|
||||
zoneIdentifier string
|
||||
ttl uint
|
||||
ttl uint32
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, host string,
|
||||
@@ -31,7 +31,7 @@ func New(data json.RawMessage, domain, host string,
|
||||
extraSettings := struct {
|
||||
Token string `json:"token"`
|
||||
ZoneIdentifier string `json:"zone_identifier"`
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
|
||||
@@ -32,7 +32,7 @@ func (p *Provider) updateRecord(ctx context.Context, client *http.Client,
|
||||
Name string `json:"name"`
|
||||
Value string `json:"value"`
|
||||
ZoneIdentifier string `json:"zone_id"`
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{
|
||||
Type: recordType,
|
||||
Name: p.host,
|
||||
|
||||
@@ -137,7 +137,7 @@ type luaDNSRecord struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content"`
|
||||
TTL int `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}
|
||||
|
||||
type luaDNSError struct {
|
||||
|
||||
@@ -20,7 +20,7 @@ type Provider struct {
|
||||
host string
|
||||
ipVersion ipversion.IPVersion
|
||||
ipv6Suffix netip.Prefix
|
||||
ttl uint
|
||||
ttl uint32
|
||||
apiKey string
|
||||
secretAPIKey string
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func New(data json.RawMessage, domain, host string,
|
||||
extraSettings := struct {
|
||||
SecretAPIKey string `json:"secret_api_key"`
|
||||
APIKey string `json:"api_key"`
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
if err != nil {
|
||||
|
||||
@@ -26,7 +26,7 @@ type Provider struct {
|
||||
username string
|
||||
password string
|
||||
useProviderIP bool
|
||||
ttl uint
|
||||
ttl uint32
|
||||
}
|
||||
|
||||
func New(data json.RawMessage, domain, host string, ipVersion ipversion.IPVersion, ipv6Suffix netip.Prefix) (
|
||||
@@ -34,7 +34,7 @@ func New(data json.RawMessage, domain, host string, ipVersion ipversion.IPVersio
|
||||
extraSettings := struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
UseProviderIP bool `json:"provider_ip"`
|
||||
}{}
|
||||
err = json.Unmarshal(data, &extraSettings)
|
||||
@@ -128,7 +128,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add
|
||||
Type string `json:"type"` // constants.A or constants.AAAA depending on ip address given
|
||||
Name string `json:"name"` // DNS record name (only the subdomain part)
|
||||
Content string `json:"content"` // ip address
|
||||
TTL uint `json:"ttl"`
|
||||
TTL uint32 `json:"ttl"`
|
||||
}{
|
||||
Type: recordType,
|
||||
Name: updateHost,
|
||||
|
||||
Reference in New Issue
Block a user