From 96f6def7010ad1e5c0fe6f9e98637dbefa309b7f Mon Sep 17 00:00:00 2001 From: Andrey Petelin Date: Wed, 10 Dec 2025 16:55:23 +0500 Subject: [PATCH 1/3] fix: lower priority of fully_routed_ips relative to routing_excluded_ips --- podkop/files/usr/bin/podkop | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/podkop/files/usr/bin/podkop b/podkop/files/usr/bin/podkop index 8b545ff..f0fbb0f 100755 --- a/podkop/files/usr/bin/podkop +++ b/podkop/files/usr/bin/podkop @@ -785,8 +785,6 @@ sing_box_configure_route() { config=$(sing_box_cf_proxy_domain "$config" "$SB_TPROXY_INBOUND_TAG" "$CHECK_PROXY_IP_DOMAIN" "$first_outbound_tag") config=$(sing_box_cf_override_domain_port "$config" "$FAKEIP_TEST_DOMAIN" 8443) - config_foreach include_source_ips_in_routing_handler "section" - configure_common_reject_route_rule local routing_excluded_ips @@ -797,6 +795,8 @@ sing_box_configure_route() { config_list_foreach "settings" "routing_excluded_ips" exclude_source_ip_from_routing_handler "$rule_tag" fi + config_foreach include_source_ips_in_routing_handler "section" + config_foreach configure_routing_for_section_lists "section" } From aa8f2cef4153658baeecdcdb3213d5b4a9cd07f2 Mon Sep 17 00:00:00 2001 From: Andrey Petelin Date: Wed, 10 Dec 2025 17:58:22 +0500 Subject: [PATCH 2/3] feat: Add log_level option in LuCI and use configured value for sing-box logging --- .../resources/view/podkop/settings.js | 18 ++++++++++++++++++ podkop/files/etc/config/podkop | 1 + podkop/files/usr/bin/podkop | 4 +++- podkop/files/usr/lib/constants.sh | 2 -- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js index 7dd8f20..6c89ed3 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js @@ -378,6 +378,24 @@ function createSettingsContent(section) { return true; }; + o = section.option( + form.ListValue, + "log_level", + _("Log Level"), + _( + "Select the log level for sing-box", + ), + ); + o.value("trace", "Trace"); + o.value("debug", "Debug"); + o.value("info", "Info"); + o.value("warn", "Warn"); + o.value("error", "Error"); + o.value("fatal", "Fatal"); + o.value("panic", "Panic"); + o.default = "warn"; + o.rmempty = false; + o = section.option( form.Flag, "exclude_ntp", diff --git a/podkop/files/etc/config/podkop b/podkop/files/etc/config/podkop index f7224fb..130b354 100644 --- a/podkop/files/etc/config/podkop +++ b/podkop/files/etc/config/podkop @@ -16,6 +16,7 @@ config settings 'settings' option dont_touch_dhcp '0' option config_path '/etc/sing-box/config.json' option cache_path '/tmp/sing-box/cache.db' + option log_level 'warn' option exclude_ntp '0' option shutdown_correctly '0' #list routing_excluded_ips '192.168.1.3' diff --git a/podkop/files/usr/bin/podkop b/podkop/files/usr/bin/podkop index f0fbb0f..bcf243b 100755 --- a/podkop/files/usr/bin/podkop +++ b/podkop/files/usr/bin/podkop @@ -590,7 +590,9 @@ sing_box_init_config() { sing_box_configure_log() { log "Configure the log section of a sing-box JSON configuration" - config=$(sing_box_cm_configure_log "$config" false "$SB_DEFAULT_LOG_LEVEL" false) + local log_level + config_get log_level "settings" "log_level" + config=$(sing_box_cm_configure_log "$config" false "$log_level" false) } sing_box_configure_inbounds() { diff --git a/podkop/files/usr/lib/constants.sh b/podkop/files/usr/lib/constants.sh index 2d2612f..4c6a490 100644 --- a/podkop/files/usr/lib/constants.sh +++ b/podkop/files/usr/lib/constants.sh @@ -22,8 +22,6 @@ NFT_INTERFACE_SET_NAME="interfaces" ## sing-box SB_REQUIRED_VERSION="1.12.0" -# Log -SB_DEFAULT_LOG_LEVEL="warn" # DNS SB_DNS_SERVER_TAG="dns-server" SB_FAKEIP_DNS_SERVER_TAG="fakeip-server" From 9976065696ffd3cd42fdcdd51d07721466748169 Mon Sep 17 00:00:00 2001 From: divocat Date: Sat, 13 Dec 2025 18:15:25 +0200 Subject: [PATCH 3/3] feat: add locales for log level --- fe-app-podkop/locales/calls.json | 28 ++++++++++++++++++------- fe-app-podkop/locales/podkop.pot | 26 +++++++++++++++-------- fe-app-podkop/locales/podkop.ru.po | 10 +++++++-- luci-app-podkop/po/ru/podkop.po | 10 +++++++-- luci-app-podkop/po/templates/podkop.pot | 26 +++++++++++++++-------- 5 files changed, 71 insertions(+), 29 deletions(-) diff --git a/fe-app-podkop/locales/calls.json b/fe-app-podkop/locales/calls.json index 970e80e..4cba8d2 100644 --- a/fe-app-podkop/locales/calls.json +++ b/fe-app-podkop/locales/calls.json @@ -529,14 +529,14 @@ "call": "Exclude NTP", "key": "Exclude NTP", "places": [ - "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:384" + "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:402" ] }, { "call": "Exclude NTP protocol traffic from the tunnel to prevent it from being routed through the proxy or VPN", "key": "Exclude NTP protocol traffic from the tunnel to prevent it from being routed through the proxy or VPN", "places": [ - "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:385" + "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:403" ] }, { @@ -711,14 +711,14 @@ "call": "Invalid HY2 URL: parsing failed", "key": "Invalid HY2 URL: parsing failed", "places": [ - "src/validators/validateHysteriaUrl.ts:113" + "src/validators/validateHysteriaUrl.ts:115" ] }, { "call": "Invalid HY2 URL: sni cannot be empty", "key": "Invalid HY2 URL: sni cannot be empty", "places": [ - "src/validators/validateHysteriaUrl.ts:106" + "src/validators/validateHysteriaUrl.ts:108" ] }, { @@ -960,6 +960,13 @@ "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:545" ] }, + { + "call": "Log Level", + "key": "Log Level", + "places": [ + "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:384" + ] + }, { "call": "Main DNS", "key": "Main DNS", @@ -1198,7 +1205,7 @@ "call": "Routing Excluded IPs", "key": "Routing Excluded IPs", "places": [ - "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:395" + "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:413" ] }, { @@ -1356,6 +1363,13 @@ "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:444" ] }, + { + "call": "Select the log level for sing-box", + "key": "Select the log level for sing-box", + "places": [ + "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:385" + ] + }, { "call": "Select the network interface from which the traffic will originate", "key": "Select the network interface from which the traffic will originate", @@ -1459,7 +1473,7 @@ "call": "Specify a local IP address to be excluded from routing", "key": "Specify a local IP address to be excluded from routing", "places": [ - "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:396" + "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:414" ] }, { @@ -1760,7 +1774,7 @@ "src/validators/validateDns.ts:18", "src/validators/validateDomain.ts:13", "src/validators/validateDomain.ts:30", - "src/validators/validateHysteriaUrl.ts:111", + "src/validators/validateHysteriaUrl.ts:113", "src/validators/validateIp.ts:8", "src/validators/validateOutboundJson.ts:7", "src/validators/validatePath.ts:16", diff --git a/fe-app-podkop/locales/podkop.pot b/fe-app-podkop/locales/podkop.pot index 542bfbe..2b23420 100644 --- a/fe-app-podkop/locales/podkop.pot +++ b/fe-app-podkop/locales/podkop.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 14:30+0200\n" -"PO-Revision-Date: 2025-12-01 14:30+0200\n" +"POT-Creation-Date: 2025-12-13 16:15+0200\n" +"PO-Revision-Date: 2025-12-13 16:15+0200\n" "Last-Translator: divocat \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -323,11 +323,11 @@ msgstr "" msgid "Every 5 minutes" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:384 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:402 msgid "Exclude NTP" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:385 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:403 msgid "Exclude NTP protocol traffic from the tunnel to prevent it from being routed through the proxy or VPN" msgstr "" @@ -430,11 +430,11 @@ msgstr "" msgid "Invalid HY2 URL: obfs-password required when obfs is set" msgstr "" -#: src/validators/validateHysteriaUrl.ts:113 +#: src/validators/validateHysteriaUrl.ts:115 msgid "Invalid HY2 URL: parsing failed" msgstr "" -#: src/validators/validateHysteriaUrl.ts:106 +#: src/validators/validateHysteriaUrl.ts:108 msgid "Invalid HY2 URL: sni cannot be empty" msgstr "" @@ -575,6 +575,10 @@ msgstr "" msgid "Local Subnet Lists" msgstr "" +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:384 +msgid "Log Level" +msgstr "" + #: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:72 msgid "Main DNS" msgstr "" @@ -713,7 +717,7 @@ msgstr "" msgid "Router DNS is routed through sing-box" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:395 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:413 msgid "Routing Excluded IPs" msgstr "" @@ -806,6 +810,10 @@ msgstr "" msgid "Select the list type for adding custom subnets" msgstr "" +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:385 +msgid "Select the log level for sing-box" +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:90 msgid "Select the network interface from which the traffic will originate" msgstr "" @@ -863,7 +871,7 @@ msgstr "" msgid "Source Network Interface" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:396 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:414 msgid "Specify a local IP address to be excluded from routing" msgstr "" @@ -1041,7 +1049,7 @@ msgstr "" #: src/validators/validateDns.ts:18 #: src/validators/validateDomain.ts:13 #: src/validators/validateDomain.ts:30 -#: src/validators/validateHysteriaUrl.ts:111 +#: src/validators/validateHysteriaUrl.ts:113 #: src/validators/validateIp.ts:8 #: src/validators/validateOutboundJson.ts:7 #: src/validators/validatePath.ts:16 diff --git a/fe-app-podkop/locales/podkop.ru.po b/fe-app-podkop/locales/podkop.ru.po index fab7459..9009a14 100644 --- a/fe-app-podkop/locales/podkop.ru.po +++ b/fe-app-podkop/locales/podkop.ru.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 16:30+0200\n" -"PO-Revision-Date: 2025-12-01 16:30+0200\n" +"POT-Creation-Date: 2025-12-13 18:15+0200\n" +"PO-Revision-Date: 2025-12-13 18:15+0200\n" "Last-Translator: divocat\n" "Language-Team: none\n" "Language: ru\n" @@ -419,6 +419,9 @@ msgstr "Локальные списки доменов" msgid "Local Subnet Lists" msgstr "Локальные списки подсетей" +msgid "Log Level" +msgstr "Уровень логов" + msgid "Main DNS" msgstr "Основной DNS" @@ -584,6 +587,9 @@ msgstr "Выберите тип списка для добавления пол msgid "Select the list type for adding custom subnets" msgstr "Выберите тип списка для добавления пользовательских подсетей" +msgid "Select the log level for sing-box" +msgstr "Выберите уровень логов для sing-box" + msgid "Select the network interface from which the traffic will originate" msgstr "Выберите сетевой интерфейс, с которого будет исходить трафик" diff --git a/luci-app-podkop/po/ru/podkop.po b/luci-app-podkop/po/ru/podkop.po index fab7459..9009a14 100644 --- a/luci-app-podkop/po/ru/podkop.po +++ b/luci-app-podkop/po/ru/podkop.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 16:30+0200\n" -"PO-Revision-Date: 2025-12-01 16:30+0200\n" +"POT-Creation-Date: 2025-12-13 18:15+0200\n" +"PO-Revision-Date: 2025-12-13 18:15+0200\n" "Last-Translator: divocat\n" "Language-Team: none\n" "Language: ru\n" @@ -419,6 +419,9 @@ msgstr "Локальные списки доменов" msgid "Local Subnet Lists" msgstr "Локальные списки подсетей" +msgid "Log Level" +msgstr "Уровень логов" + msgid "Main DNS" msgstr "Основной DNS" @@ -584,6 +587,9 @@ msgstr "Выберите тип списка для добавления пол msgid "Select the list type for adding custom subnets" msgstr "Выберите тип списка для добавления пользовательских подсетей" +msgid "Select the log level for sing-box" +msgstr "Выберите уровень логов для sing-box" + msgid "Select the network interface from which the traffic will originate" msgstr "Выберите сетевой интерфейс, с которого будет исходить трафик" diff --git a/luci-app-podkop/po/templates/podkop.pot b/luci-app-podkop/po/templates/podkop.pot index 542bfbe..2b23420 100644 --- a/luci-app-podkop/po/templates/podkop.pot +++ b/luci-app-podkop/po/templates/podkop.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-12-01 14:30+0200\n" -"PO-Revision-Date: 2025-12-01 14:30+0200\n" +"POT-Creation-Date: 2025-12-13 16:15+0200\n" +"PO-Revision-Date: 2025-12-13 16:15+0200\n" "Last-Translator: divocat \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -323,11 +323,11 @@ msgstr "" msgid "Every 5 minutes" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:384 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:402 msgid "Exclude NTP" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:385 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:403 msgid "Exclude NTP protocol traffic from the tunnel to prevent it from being routed through the proxy or VPN" msgstr "" @@ -430,11 +430,11 @@ msgstr "" msgid "Invalid HY2 URL: obfs-password required when obfs is set" msgstr "" -#: src/validators/validateHysteriaUrl.ts:113 +#: src/validators/validateHysteriaUrl.ts:115 msgid "Invalid HY2 URL: parsing failed" msgstr "" -#: src/validators/validateHysteriaUrl.ts:106 +#: src/validators/validateHysteriaUrl.ts:108 msgid "Invalid HY2 URL: sni cannot be empty" msgstr "" @@ -575,6 +575,10 @@ msgstr "" msgid "Local Subnet Lists" msgstr "" +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:384 +msgid "Log Level" +msgstr "" + #: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:72 msgid "Main DNS" msgstr "" @@ -713,7 +717,7 @@ msgstr "" msgid "Router DNS is routed through sing-box" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:395 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:413 msgid "Routing Excluded IPs" msgstr "" @@ -806,6 +810,10 @@ msgstr "" msgid "Select the list type for adding custom subnets" msgstr "" +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:385 +msgid "Select the log level for sing-box" +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:90 msgid "Select the network interface from which the traffic will originate" msgstr "" @@ -863,7 +871,7 @@ msgstr "" msgid "Source Network Interface" msgstr "" -#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:396 +#: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:414 msgid "Specify a local IP address to be excluded from routing" msgstr "" @@ -1041,7 +1049,7 @@ msgstr "" #: src/validators/validateDns.ts:18 #: src/validators/validateDomain.ts:13 #: src/validators/validateDomain.ts:30 -#: src/validators/validateHysteriaUrl.ts:111 +#: src/validators/validateHysteriaUrl.ts:113 #: src/validators/validateIp.ts:8 #: src/validators/validateOutboundJson.ts:7 #: src/validators/validatePath.ts:16