Add error checking to lookup host (#1847)
This commit is contained in:
parent
344b1dc559
commit
668627f890
1 changed files with 10 additions and 1 deletions
|
@ -64,7 +64,7 @@ func GetExprEnv(ctx map[string]interface{}) map[string]interface{} {
|
|||
"XMLGetNodeValue": XMLGetNodeValue,
|
||||
"IpToRange": IpToRange,
|
||||
"IsIPV6": IsIPV6,
|
||||
"LookupHost": net.LookupHost,
|
||||
"LookupHost": LookupHost,
|
||||
"GetDecisionsCount": GetDecisionsCount,
|
||||
"GetDecisionsSinceCount": GetDecisionsSinceCount,
|
||||
"Sprintf": fmt.Sprintf,
|
||||
|
@ -281,3 +281,12 @@ func GetDecisionsSinceCount(value string, since string) int {
|
|||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func LookupHost(value string) []string {
|
||||
addresses , err := net.LookupHost(value)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to lookup host '%s' : %s", value, err)
|
||||
return []string{}
|
||||
}
|
||||
return addresses
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue