fix: fix logic on p.Data.Ip
All checks were successful
golangci-lint / lint (push) Successful in 41s
All checks were successful
golangci-lint / lint (push) Successful in 41s
This commit is contained in:
parent
303193751b
commit
3a2be02e0a
1 changed files with 6 additions and 6 deletions
|
@ -89,6 +89,12 @@ func getIpAddress() string {
|
||||||
|
|
||||||
func (p *Porkbun) updateIp() {
|
func (p *Porkbun) updateIp() {
|
||||||
dnsIp, err := resolver.LookupHost(context.Background(), p.Domain)
|
dnsIp, err := resolver.LookupHost(context.Background(), p.Domain)
|
||||||
|
p.Data.Ip = getIpAddress()
|
||||||
|
if p.Data.Ip == "" {
|
||||||
|
log.Print("Failed to retrieve current public IP address")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Failed to retrieve IP address for domain " + p.Domain + ": " + err.Error())
|
log.Print("Failed to retrieve IP address for domain " + p.Domain + ": " + err.Error())
|
||||||
return
|
return
|
||||||
|
@ -102,12 +108,6 @@ func (p *Porkbun) updateIp() {
|
||||||
}
|
}
|
||||||
log.Print("Current IP of the record '" + p.Domain + "' is " + dnsIp[0])
|
log.Print("Current IP of the record '" + p.Domain + "' is " + dnsIp[0])
|
||||||
|
|
||||||
p.Data.Ip = getIpAddress()
|
|
||||||
if p.Data.Ip == "" {
|
|
||||||
log.Print("Failed to retrieve current public IP address")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Porkbun uses a string for the `"ttl"` key.
|
// Porkbun uses a string for the `"ttl"` key.
|
||||||
p.Data.Ttl = string(p.Ttl)
|
p.Data.Ttl = string(p.Ttl)
|
||||||
p.Data.ApiKey = &p.ApiKey
|
p.Data.ApiKey = &p.ApiKey
|
||||||
|
|
Loading…
Add table
Reference in a new issue