gistfile1.txt
· 454 B · Text
Originalformat
local block_file
block_file="$(ctx::block::path "${name}.block")"
local blocks=""
if [[ -f "$block_file" ]] && [[ -s "$block_file" ]]; then
while IFS=" " read -r client_ip target port proto; do
if [[ -z "$target" ]]; then
blocks+=" all traffic blocked\n"
else
local rule=" ${target}"
[[ -n "$port" ]] && rule+=":${port}/${proto}"
blocks+="${rule}\n"
fi
done < "$block_file"
fi
| 1 | local block_file |
| 2 | block_file="$(ctx::block::path "${name}.block")" |
| 3 | local blocks="" |
| 4 | if [[ -f "$block_file" ]] && [[ -s "$block_file" ]]; then |
| 5 | while IFS=" " read -r client_ip target port proto; do |
| 6 | if [[ -z "$target" ]]; then |
| 7 | blocks+=" all traffic blocked\n" |
| 8 | else |
| 9 | local rule=" ${target}" |
| 10 | [[ -n "$port" ]] && rule+=":${port}/${proto}" |
| 11 | blocks+="${rule}\n" |
| 12 | fi |
| 13 | done < "$block_file" |
| 14 | fi |