Skip to content

Commit

Permalink
micro-optimze away a function call
Browse files Browse the repository at this point in the history
  • Loading branch information
toralf committed Jul 12, 2024
1 parent db8f646 commit e4117c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ function printMetrics() {
else
echo "$tables6"
fi |
grep ' DROP .* match-set tor-ddos'$v'-' |
while read -r pkts remain; do
name=$(grep -Eo ' tor-ddos.* ' <<<$remain | tr -d ' ')
nickname=${NICKNAME:-$(_ipset2nickname $name)}
grep ' DROP .* match-set tor-ddos'$v'-' | awk '{ print $1, $11 }' |
while read -r pkts dport; do
orport=$(cut -f 2 -d ':' <<<$dport)
nickname=${NICKNAME:-$(_orport2nickname $orport)}
echo "$var{ipver=\"${v:-4}\",nickname=\"$nickname\"} $pkts"
done
done
Expand Down

0 comments on commit e4117c9

Please sign in to comment.