mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-04 23:33:56 +08:00
🌴 Sync 2026-07-14 04:31:14
This commit is contained in:
1 parent
e652a38f70
commit
fd29dc0037
47 files changed
+926
-789
No files matched your search
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.7.12
|
||||
PKG_RELEASE:=60
|
||||
PKG_RELEASE:=61
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -152,7 +152,9 @@ if load_balancing_options then -- [[ Load balancing Start ]]
|
||||
o:depends({ [_n("node_add_mode")] = "batch" })
|
||||
local descrStr = "Example: <code>^A && B && !C && D$</code><br>"
|
||||
descrStr = descrStr .. "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).<br>"
|
||||
descrStr = descrStr .. "Conditions are joined by <code>&&</code>, and their order does not affect the result."
|
||||
descrStr = descrStr .. "Conditions are joined by <code>&&</code> (AND), and their order does not affect the result.<br>"
|
||||
descrStr = descrStr .. "Multiple groups can be separated by <code>||</code> (OR), matching succeeds if any group matches.<br>"
|
||||
descrStr = descrStr .. "Example: <code>A && B || C && D</code> means (A AND B) OR (C AND D)."
|
||||
o.description = translate(descrStr)
|
||||
|
||||
o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy"))
|
||||
|
||||
@@ -154,7 +154,9 @@ if load_urltest_options then -- [[ URLTest Start ]]
|
||||
o:depends({ [_n("node_add_mode")] = "batch" })
|
||||
local descrStr = "Example: <code>^A && B && !C && D$</code><br>"
|
||||
descrStr = descrStr .. "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).<br>"
|
||||
descrStr = descrStr .. "Conditions are joined by <code>&&</code>, and their order does not affect the result."
|
||||
descrStr = descrStr .. "Conditions are joined by <code>&&</code> (AND), and their order does not affect the result.<br>"
|
||||
descrStr = descrStr .. "Multiple groups can be separated by <code>||</code> (OR), matching succeeds if any group matches.<br>"
|
||||
descrStr = descrStr .. "Example: <code>A && B || C && D</code> means (A AND B) OR (C AND D)."
|
||||
o.description = translate(descrStr)
|
||||
|
||||
o = s:option(Value, _n("urltest_url"), translate("Probe URL"))
|
||||
|
||||
@@ -1521,11 +1521,22 @@ end
|
||||
function match_node_rule(name, rule)
|
||||
if not name then return false end
|
||||
if not rule or rule == "" then return true end
|
||||
-- split rule by || into OR groups
|
||||
local function split_or(expr)
|
||||
local t = {}
|
||||
for part in (expr .. "||"):gmatch("(.-)%|%|") do
|
||||
part = trim(part)
|
||||
if part ~= "" then
|
||||
table.insert(t, part)
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
-- split rule by &&
|
||||
local function split_and(expr)
|
||||
local t = {}
|
||||
for part in expr:gmatch("[^&]+") do
|
||||
part = part:gsub("^%s+", ""):gsub("%s+$", "")
|
||||
for part in (expr .. "&&"):gmatch("(.-)%&%&") do
|
||||
part = trim(part)
|
||||
if part ~= "" then
|
||||
table.insert(t, part)
|
||||
end
|
||||
@@ -1556,13 +1567,22 @@ function match_node_rule(name, rule)
|
||||
-- contains
|
||||
return str:find(cond, 1, true) ~= nil
|
||||
end
|
||||
-- AND logic
|
||||
for _, cond in ipairs(split_and(rule)) do
|
||||
if not match_cond(name, cond) then
|
||||
return false
|
||||
-- check if all conditions in AND group match
|
||||
local function match_and_group(str, group_expr)
|
||||
for _, cond in ipairs(split_and(group_expr)) do
|
||||
if not match_cond(str, cond) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
-- OR logic: return true if any group matches
|
||||
for _, group in ipairs(split_or(rule)) do
|
||||
if match_and_group(name, group) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return true
|
||||
return false
|
||||
end
|
||||
|
||||
function get_core(field, candidates)
|
||||
|
||||
@@ -394,11 +394,15 @@ msgstr "قوانین تطبیق گره"
|
||||
msgid ""
|
||||
"Example: <code>^A && B && !C && D$</code><br>"
|
||||
"This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).<br>"
|
||||
"Conditions are joined by <code>&&</code>, and their order does not affect the result."
|
||||
"Conditions are joined by <code>&&</code> (AND), and their order does not affect the result.<br>"
|
||||
"Multiple groups can be separated by <code>||</code> (OR), matching succeeds if any group matches.<br>"
|
||||
"Example: <code>A && B || C && D</code> means (A AND B) OR (C AND D)."
|
||||
msgstr ""
|
||||
"مثال: <code>^A && B && !C && D$</code><br>"
|
||||
"این بدان معناست که توضیحات گره باید با A شروع شود (^)، شامل B باشد، فاقد C باشد (!)، و با D پایان یابد ($).<br>"
|
||||
"شرطها با <code>&&</code> به هم متصل میشوند و ترتیب آنها تاثیری در نتیجه ندارد."
|
||||
"شرطها با <code>&&</code> (و) به هم متصل میشوند و ترتیب آنها تاثیری در نتیجه ندارد.<br>"
|
||||
"چندین گروه شرط میتوانند با <code>||</code> (یا) از هم جدا شوند؛ اگر هر گروهی مطابقت داشته باشد، نتیجه موفقیتآمیز است.<br>"
|
||||
"مثال: <code>A && B || C && D</code> به معنای (A و B) یا (C و D) است."
|
||||
|
||||
|
||||
msgid "Balancing Strategy"
|
||||
|
||||
@@ -391,11 +391,15 @@ msgstr "Правила отбора узлов"
|
||||
msgid ""
|
||||
"Example: <code>^A && B && !C && D$</code><br>"
|
||||
"This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).<br>"
|
||||
"Conditions are joined by <code>&&</code>, and their order does not affect the result."
|
||||
"Conditions are joined by <code>&&</code> (AND), and their order does not affect the result.<br>"
|
||||
"Multiple groups can be separated by <code>||</code> (OR), matching succeeds if any group matches.<br>"
|
||||
"Example: <code>A && B || C && D</code> means (A AND B) OR (C AND D)."
|
||||
msgstr ""
|
||||
"Пример: <code>^A && B && !C && D$</code><br>"
|
||||
"Описание узла должно: начинаться с A (^), содержать B, не содержать C (!), заканчиваться на D ($).<br>"
|
||||
"Условия соединяются оператором <code>&&</code>, порядок условий не влияет на результат."
|
||||
"Условия соединяются оператором <code>&&</code> (И), порядок условий не влияет на результат.<br>"
|
||||
"Несколько групп условий можно разделить оператором <code>||</code> (ИЛИ); совпадение любой группы считается успехом.<br>"
|
||||
"Пример: <code>A && B || C && D</code> означает (A И B) ИЛИ (C И D)."
|
||||
|
||||
msgid "Balancing Strategy"
|
||||
msgstr "Алгоритм балансировки"
|
||||
|
||||
@@ -391,11 +391,15 @@ msgstr "节点匹配规则"
|
||||
msgid ""
|
||||
"Example: <code>^A && B && !C && D$</code><br>"
|
||||
"This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).<br>"
|
||||
"Conditions are joined by <code>&&</code>, and their order does not affect the result."
|
||||
"Conditions are joined by <code>&&</code> (AND), and their order does not affect the result.<br>"
|
||||
"Multiple groups can be separated by <code>||</code> (OR), matching succeeds if any group matches.<br>"
|
||||
"Example: <code>A && B || C && D</code> means (A AND B) OR (C AND D)."
|
||||
msgstr ""
|
||||
"示例:<code>^A && B && !C && D$</code><br>"
|
||||
"表示节点备注需同时满足:以 A 开头(^)、包含 B、不包含 C(!)、并以 D 结尾($)。<br>"
|
||||
"多个条件使用 <code>&&</code> 连接,条件顺序不影响结果。"
|
||||
"多个条件使用 <code>&&</code>(与)连接,条件顺序不影响结果。<br>"
|
||||
"多组条件之间可使用 <code>||</code>(或)分隔,任意一组匹配即视为成功。<br>"
|
||||
"示例:<code>A && B || C && D</code> 表示 (A 且 B) 或 (C 且 D)。"
|
||||
|
||||
msgid "Balancing Strategy"
|
||||
msgstr "负载均衡策略"
|
||||
|
||||
@@ -391,11 +391,15 @@ msgstr "節點匹配規則"
|
||||
msgid ""
|
||||
"Example: <code>^A && B && !C && D$</code><br>"
|
||||
"This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).<br>"
|
||||
"Conditions are joined by <code>&&</code>, and their order does not affect the result."
|
||||
"Conditions are joined by <code>&&</code> (AND), and their order does not affect the result.<br>"
|
||||
"Multiple groups can be separated by <code>||</code> (OR), matching succeeds if any group matches.<br>"
|
||||
"Example: <code>A && B || C && D</code> means (A AND B) OR (C AND D)."
|
||||
msgstr ""
|
||||
"示例:<code>^A && B && !C && D$</code><br>"
|
||||
"表示節點備註需同時滿足:以 A 開頭(^)、包含 B、不包含 C(!)、並以 D 結尾($)。<br>"
|
||||
"多個條件使用 <code>&&</code> 連接,條件順序不影響結果。"
|
||||
"多個條件使用 <code>&&</code>(與)連接,條件順序不影響結果。<br>"
|
||||
"多組條件之間可使用 <code>||</code>(或)分隔,任意一組匹配即視為成功。<br>"
|
||||
"示例:<code>A && B || C && D</code> 表示 (A 且 B) 或 (C 且 D)。"
|
||||
|
||||
msgid "Balancing Strategy"
|
||||
msgstr "負載均衡策略"
|
||||
|
||||
@@ -160,25 +160,28 @@ insert_nftset() {
|
||||
*) suffix=" timeout $timeout_argument" ;;
|
||||
esac
|
||||
{
|
||||
if [ $# -gt 0 ]; then
|
||||
if [ $# -gt 0 ] && [ $# -le 1000 ]; then
|
||||
printf "%s\n" "$@"
|
||||
elif [ $# -gt 1000 ]; then
|
||||
printf "%s\n" "$*"
|
||||
else
|
||||
cat
|
||||
fi | awk -v s="$suffix" -v n="$nftset_name" -v t="$NFTABLE_NAME" '
|
||||
BEGIN {
|
||||
RS = "[ \t\n\r]+"
|
||||
ORS = ""
|
||||
}
|
||||
$0 != "" {
|
||||
if (first == 0) {
|
||||
printf "add element %s %s { \n", t, n;
|
||||
if (!first) {
|
||||
printf "add element %s %s { \n", t, n
|
||||
first = 1;
|
||||
} else {
|
||||
printf ",\n";
|
||||
print ",\n"
|
||||
}
|
||||
printf "%s%s", $0, s;
|
||||
print $0 s
|
||||
}
|
||||
END {
|
||||
if (first == 1) printf "\n }\n";
|
||||
if (first) print "\n }\n"
|
||||
}
|
||||
'
|
||||
} | nft -f -
|
||||
|
||||
Reference in new issue
Block a user