diff --git a/pkg/exprhelpers/exprlib.go b/pkg/exprhelpers/exprlib.go index 5de7114ac..26d29b5c2 100644 --- a/pkg/exprhelpers/exprlib.go +++ b/pkg/exprhelpers/exprlib.go @@ -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 +}