better error-handling if no public IP could be detected (#323)

This commit is contained in:
Matze 2023-03-15 21:41:46 +01:00 committed by GitHub
parent 814093cdd3
commit abef29bf17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -220,10 +220,12 @@ func GetPublicIP() (model.Interface, error) {
ip, err := consensus.ExternalIP()
if err != nil {
publicInterface.IPAddress = "N/A"
} else {
publicInterface.IPAddress = ip.String()
}
publicInterface.IPAddress = ip.String()
return publicInterface, err
// error handling happend above, no need to pass it through
return publicInterface, nil
}
// GetIPFromCIDR get ip from CIDR