fixed bug ignoring proxy status on record creation
This commit is contained in:
parent
4ae17d2348
commit
960c6b621c
2 changed files with 6 additions and 11 deletions
|
|
@ -53,6 +53,7 @@ func checkAndUpdate(
|
|||
Name: domain.Hostname,
|
||||
Content: address,
|
||||
Type: recordType,
|
||||
Proxied: domain.Proxied,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -70,7 +71,7 @@ func checkAndUpdate(
|
|||
ctxTimeout, cancel = context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
|
||||
if record.Content == address {
|
||||
if record.Content == address && (record.Proxied == nil || domain.Proxied == nil || (*record.Proxied == *domain.Proxied)) {
|
||||
log.Info().
|
||||
Str("id", record.ID).
|
||||
Str("hostname", record.Name).
|
||||
|
|
|
|||
14
cmd/loop.go
14
cmd/loop.go
|
|
@ -23,12 +23,9 @@ func loop(ctx context.Context, api *cloudflare.API, cfg *config.Config) {
|
|||
}()
|
||||
|
||||
if cfg.IPv4 {
|
||||
ipv4, err := GetPublicIPv4()
|
||||
if err != nil {
|
||||
if ipv4, err := GetPublicIPv4(); err != nil {
|
||||
log.Panic().Err(err).Msg("failed to get public ipv4")
|
||||
}
|
||||
|
||||
if ipv4 != currentIPv4 {
|
||||
} else if ipv4 != currentIPv4 {
|
||||
currentIPv4 = ipv4
|
||||
log.Info().Msgf("updated ipv4 address: %s", ipv4)
|
||||
}
|
||||
|
|
@ -45,12 +42,9 @@ func loop(ctx context.Context, api *cloudflare.API, cfg *config.Config) {
|
|||
}
|
||||
|
||||
if cfg.IPv6 {
|
||||
ipv6, err := GetPublicIPv6()
|
||||
if err != nil {
|
||||
if ipv6, err := GetPublicIPv6(); err != nil {
|
||||
log.Panic().Err(err).Msg("failed to get public ipv6")
|
||||
}
|
||||
|
||||
if ipv6 != currentIPv6 {
|
||||
} else if ipv6 != currentIPv6 {
|
||||
currentIPv6 = ipv6
|
||||
log.Info().Msgf("updated ipv6 address: %s", ipv6)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue