Created
May 3, 2018 12:44
-
-
Save ExternalReality/f99e013ad6639ec6db5869c9bd59c5a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func resolveNetworkInfoAddresses(networkInfoResult params.NetworkInfoResult) params.NetworkInfoResult { | |
for i, networkInfo := range networkInfoResult.Info { | |
for j, interfaceAddress := range networkInfo.Addresses { | |
resolvedAddress, err := manual.HostAddress(interfaceAddress.Address) | |
if err != nil { | |
logger.Warningf("The address %q is neither an IP address or a resolvable hostname", interfaceAddress.Address) | |
logger.Errorf("%s", err.Error()) | |
} | |
networkInfoResult.Info[i].Addresses[j].Address = resolvedAddress.String() | |
} | |
} | |
return networkInfoResult | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment