mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 09:55:13 +08:00
34 lines
1.1 KiB
Bash
Executable File
34 lines
1.1 KiB
Bash
Executable File
# SPDX-License-Identifier: Apache-2.0
|
|
# Copyright 2025-2026 Lucas Albers <lucas.b.albers@gmail.com>
|
|
#
|
|
# GENERATED FILE — do not edit. Run: ./scripts/gen-all.sh
|
|
# source: core/fwlive-log.js CLASSIFY_SPEC
|
|
# Shared isFirewallEvent parity logic (shell). Sourced by fwlive-log-filter.sh and tests.
|
|
# Sourced library: do not add set -euo here; callers own strict mode.
|
|
# One awk process classifies a batch (MODE=json/json_reply) or one message (default).
|
|
|
|
# The caller sets FILTER_DIR when this file is sourced. Resolve the asset
|
|
# once, not once per classification call.
|
|
CLASSIFY_AWK="${FILTER_DIR:-${0%/*}}/fwlive-is-firewall-event.awk"
|
|
|
|
_fwlive_run_classify() {
|
|
if [ "${1:-msg}" = json_reply ]; then
|
|
LC_ALL=C awk -v MODE="${1:-msg}" -v SUMMARY="${FWLIVE_SUMMARY:-1}" -f "$CLASSIFY_AWK"
|
|
else
|
|
awk -v MODE="${1:-msg}" -v SUMMARY="${FWLIVE_SUMMARY:-1}" -f "$CLASSIFY_AWK"
|
|
fi
|
|
}
|
|
|
|
is_firewall_event_msg() {
|
|
_r=$(printf '%s' "$1" | _fwlive_run_classify msg)
|
|
[ "$_r" = 1 ]
|
|
}
|
|
|
|
_fwlive_filter_json_entries() {
|
|
_fwlive_run_classify json
|
|
}
|
|
|
|
_fwlive_filter_json_reply() {
|
|
_fwlive_run_classify json_reply
|
|
}
|