# Parameters for querying IPFire Location DB
#
# Returns Location DB lookup for one or more IP addresses
UserParameter=ipfire.locationdb.lookup[*],/usr/bin/location lookup $1 $2 $3 $4 $5 $6 $7 $8 $9 2>&1 | awk -F"[[:space:]]*:[[:space:]]*" 'BEGIN { printf "{" } /[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+:/ { printf "%s\"%s\":{",separator,$$1; separator = "," } /^[[:space:]]*Network/ { printf "\"network\":\"" $$2 "\"" } /^[[:space:]]*Country/ { printf ",\"country\":\"" $$2 "\"" } /^[[:space:]]*Autonomous System/ { printf ",\"as\":\"" $$2 "\"}" } /Errno [[:digit:]]+/ { printf "\"error\":\"%s\"",$$0 } END { printf "}" }'
# Returns the Unix timestamp of the IPFire Location DB version
UserParameter=ipfire.locationdb.version,date -d"$(/usr/bin/location version)" +%s
