fix handling if no IP could be detected
The current code for no public IP-Address ends with a panic because the error is passed through even it got handled. This commit corrects this.
This commit is contained in:
parent
f256668a99
commit
7d9538f250
|
|
@ -221,10 +221,12 @@ func GetPublicIP() (model.Interface, error) {
|
||||||
ip, err := consensus.ExternalIP()
|
ip, err := consensus.ExternalIP()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
publicInterface.IPAddress = "N/A"
|
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
|
// GetIPFromCIDR get ip from CIDR
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue