mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 19:05:13 +08:00
🎄 Sync 2026-09-26 02:25:56
This commit is contained in:
1 parent
99196a85d3
commit
4136a9b488
73 files changed
+2401
-4124
No files matched your search
@@ -15,8 +15,8 @@ function normalize(s, keys, n, i, k) {
|
||||
return s
|
||||
}
|
||||
function trim(s) {
|
||||
sub(/^[[:space:]]+/, "", s)
|
||||
sub(/[[:space:]]+$/, "", s)
|
||||
sub(/^([ \t\n\r]|\302\240)+/, "", s)
|
||||
sub(/([ \t\n\r]|\302\240)+$/, "", s)
|
||||
return s
|
||||
}
|
||||
function has_kv(s, key) {
|
||||
@@ -136,11 +136,17 @@ function summary_rule(s, first) {
|
||||
s = trim(normalize(s))
|
||||
sub(/^\[[[:space:]]*[0-9.]+\][[:space:]]*/, "", s)
|
||||
if (tolower(s) ~ /^fw4:[[:space:]]*/) return "fw4"
|
||||
first = s
|
||||
sub(/[[:space:]:].*/, "", first)
|
||||
if (first == "" || first ~ /^(IN|OUT|SRC|DST|PROTO|SPT|DPT|LEN|MAC|TYPE|CODE|TTL|TOS|PREC|DF)=/) return ""
|
||||
if (tolower(first) == "kernel" || tolower(first) == "iptables") return ""
|
||||
return utf8_prefix(first, 64)
|
||||
# Shared with parseRuleHint: token then IN=/OUT=/SRC=/DST=/PROTO=, else colon tag.
|
||||
if (match(s, "^[A-Za-z0-9_.-]+(:|[[:space:]]+)(IN=|OUT=|SRC=|DST=|PROTO=)")) {
|
||||
match(s, "^[A-Za-z0-9_.-]+")
|
||||
return utf8_prefix(substr(s, RSTART, RLENGTH), 64)
|
||||
}
|
||||
if (match(s, "^[A-Za-z0-9_.-]+:")) {
|
||||
first = substr(s, RSTART, RLENGTH - 1)
|
||||
if (tolower(first) == "kernel" || tolower(first) == "iptables") return ""
|
||||
return utf8_prefix(first, 64)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
function summary_add_count(counts, key) {
|
||||
if (key != "") counts[key]++
|
||||
|
||||
Reference in new issue
Block a user