From 896fe66ef02117dfd3e14556f3fd96fef491918b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 4 Jun 2026 01:12:20 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=9E=20Sync=202026-06-04=2001:12:20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luci-app-momo/Makefile | 4 +- .../luci-static/resources/view/momo/app.js | 16 +++ .../luci-static/resources/view/momo/log.js | 3 + luci-app-momo/po/templates/momo.pot | 70 +++++++----- luci-app-momo/po/zh_Hans/momo.po | 106 ++++++++---------- momo/Makefile | 4 +- momo/files/momo.conf | 1 + momo/files/momo.init | 24 +++- momo/files/uci-defaults/migrate.sh | 3 + momo/files/ucode/hijack.ut | 4 + 10 files changed, 144 insertions(+), 91 deletions(-) diff --git a/luci-app-momo/Makefile b/luci-app-momo/Makefile index 40b888d4..561d3f27 100644 --- a/luci-app-momo/Makefile +++ b/luci-app-momo/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=1.2.0 -PKG_RELEASE:=5 +PKG_VERSION:=1.2.1 +PKG_RELEASE:=6 LUCI_TITLE:=LuCI Support for momo LUCI_DEPENDS:=+luci-base +momo diff --git a/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js b/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js index 27840a3c..acc7aa32 100644 --- a/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js +++ b/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js @@ -134,6 +134,12 @@ return view.extend({ s.tab('rlimit', _('RLIMIT Config')); + o = s.taboption('rlimit', form.Value, 'rlimit_nproc_soft', _('Number of Processes Soft Limit')); + o.datatype = 'uinteger'; + + o = s.taboption('rlimit', form.Value, 'rlimit_nproc_hard', _('Number of Processes Hard Limit')); + o.datatype = 'uinteger'; + o = s.taboption('rlimit', form.Value, 'rlimit_address_space_soft', _('Address Space Size Soft Limit')); o.datatype = 'uinteger'; o.placeholder = _('Unlimited'); @@ -164,6 +170,16 @@ return view.extend({ o = s.taboption('rlimit', form.Value, 'rlimit_nofile_hard', _('Number of Open Files Hard Limit')); o.datatype = 'uinteger'; + s.tab('environment_variable', _('Environment Variable Config')); + + o = s.taboption('environment_variable', form.Value, 'env_go_max_procs', 'GOMAXPROCS'); + o.datatype = 'uinteger'; + o.placeholder = _('Unlimited'); + + o = s.taboption('environment_variable', form.Value, 'env_go_mem_limit', 'GOMEMLIMIT'); + o.datatype = 'uinteger'; + o.placeholder = _('Unlimited'); + return m.render(); } }); diff --git a/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js b/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js index 0bd81cf1..fa0b6e5d 100644 --- a/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js +++ b/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js @@ -28,6 +28,9 @@ return view.extend({ s.tab('log_config', _('Log Config')); + o = s.taboption('log_config', form.Flag, 'clear_at_stop', _('Clear At Stop')); + o.rmempty = false; + o = s.taboption('log_config', form.Flag, 'scheduled_clear', _('Scheduled Clear')); o.rmempty = false; diff --git a/luci-app-momo/po/templates/momo.pot b/luci-app-momo/po/templates/momo.pot index e84f1adc..3062b187 100644 --- a/luci-app-momo/po/templates/momo.pot +++ b/luci-app-momo/po/templates/momo.pot @@ -14,11 +14,11 @@ msgstr "" msgid "Access Control" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:141 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:147 msgid "Address Space Size Hard Limit" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:137 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:143 msgid "Address Space Size Soft Limit" msgstr "" @@ -32,7 +32,7 @@ msgstr "" msgid "App Config" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:53 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:56 msgid "App Log" msgstr "" @@ -92,8 +92,12 @@ msgstr "" msgid "Choose Profile" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:57 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:90 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:31 +msgid "Clear At Stop" +msgstr "" + +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:60 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:93 msgid "Clear Log" msgstr "" @@ -102,7 +106,7 @@ msgstr "" msgid "Commonly Used Port" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:86 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:89 msgid "Core Log" msgstr "" @@ -151,7 +155,7 @@ msgstr "" msgid "DNS Strategy" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:119 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:122 msgid "Debug Log" msgstr "" @@ -206,6 +210,10 @@ msgstr "" msgid "Enable" msgstr "" +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:173 +msgid "Environment Variable Config" +msgstr "" + #: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/profile.js:50 msgid "Expire At" msgstr "" @@ -231,7 +239,7 @@ msgstr "" msgid "General Config" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:123 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:126 msgid "Generate & Download" msgstr "" @@ -243,11 +251,11 @@ msgstr "" msgid "Group" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:149 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:155 msgid "Heap Size Hard Limit" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:145 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:151 msgid "Heap Size Soft Limit" msgstr "" @@ -358,14 +366,22 @@ msgstr "" msgid "Not Running" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:164 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:170 msgid "Number of Open Files Hard Limit" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:161 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:167 msgid "Number of Open Files Soft Limit" msgstr "" +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:140 +msgid "Number of Processes Hard Limit" +msgstr "" + +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:137 +msgid "Number of Processes Soft Limit" +msgstr "" + #: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:89 msgid "Open Dashboard" msgstr "" @@ -438,19 +454,19 @@ msgstr "" msgid "Running" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:31 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:34 msgid "Scheduled Clear" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:34 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:37 msgid "Scheduled Clear Cron" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:39 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:42 msgid "Scheduled Clear Size Limit" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:45 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:48 msgid "Scheduled Clear Size Limit Unit" msgstr "" @@ -462,16 +478,16 @@ msgstr "" msgid "Scheduled Restart Cron" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:80 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:113 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:83 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:116 msgid "Scroll To Bottom" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:157 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:163 msgid "Stack Size Hard Limit" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:153 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:159 msgid "Stack Size Soft Limit" msgstr "" @@ -554,12 +570,14 @@ msgstr "" msgid "UI Path" msgstr "" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:139 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:143 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:147 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:151 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:155 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:159 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:145 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:149 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:153 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:157 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:161 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:165 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:177 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:181 msgid "Unlimited" msgstr "" diff --git a/luci-app-momo/po/zh_Hans/momo.po b/luci-app-momo/po/zh_Hans/momo.po index 8e834d95..803d3c5a 100644 --- a/luci-app-momo/po/zh_Hans/momo.po +++ b/luci-app-momo/po/zh_Hans/momo.po @@ -21,11 +21,11 @@ msgstr "API 密码" msgid "Access Control" msgstr "访问控制" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:141 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:147 msgid "Address Space Size Hard Limit" msgstr "地址空间大小硬限制" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:137 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:143 msgid "Address Space Size Soft Limit" msgstr "地址空间大小软限制" @@ -39,7 +39,7 @@ msgstr "全部端口" msgid "App Config" msgstr "插件配置" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:53 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:56 msgid "App Log" msgstr "插件日志" @@ -99,8 +99,12 @@ msgstr "选择文件" msgid "Choose Profile" msgstr "选择配置文件" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:57 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:90 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:31 +msgid "Clear At Stop" +msgstr "停止时清空" + +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:60 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:93 msgid "Clear Log" msgstr "清空日志" @@ -109,7 +113,7 @@ msgstr "清空日志" msgid "Commonly Used Port" msgstr "常用端口" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:86 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:89 msgid "Core Log" msgstr "核心日志" @@ -158,7 +162,7 @@ msgstr "DNS 反向映射" msgid "DNS Strategy" msgstr "DNS 策略" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:119 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:122 msgid "Debug Log" msgstr "调试日志" @@ -213,6 +217,10 @@ msgstr "编辑器" msgid "Enable" msgstr "启用" +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:173 +msgid "Environment Variable Config" +msgstr "环境变量配置" + #: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/profile.js:50 msgid "Expire At" msgstr "到期时间" @@ -238,7 +246,7 @@ msgstr "文件:" msgid "General Config" msgstr "全局配置" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:123 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:126 msgid "Generate & Download" msgstr "生成并下载" @@ -250,11 +258,11 @@ msgstr "授予访问 momo 程序的权限" msgid "Group" msgstr "用户组" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:149 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:155 msgid "Heap Size Hard Limit" msgstr "堆大小硬限制" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:145 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:151 msgid "Heap Size Soft Limit" msgstr "堆大小软限制" @@ -365,14 +373,22 @@ msgstr "NTP 服务端口" msgid "Not Running" msgstr "未在运行" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:164 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:170 msgid "Number of Open Files Hard Limit" msgstr "打开文件数量硬限制" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:161 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:167 msgid "Number of Open Files Soft Limit" msgstr "打开文件数量软限制" +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:140 +msgid "Number of Processes Hard Limit" +msgstr "进程数硬限制" + +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:137 +msgid "Number of Processes Soft Limit" +msgstr "进程数软限制" + #: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:89 msgid "Open Dashboard" msgstr "打开面板" @@ -445,19 +461,19 @@ msgstr "路由器代理" msgid "Running" msgstr "运行中" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:31 -msgid "Scheduled Clear" -msgstr "定时清除"" - #: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:34 +msgid "Scheduled Clear" +msgstr "定时清空" + +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:37 msgid "Scheduled Clear Cron" msgstr "Cron 表达式" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:39 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:42 msgid "Scheduled Clear Size Limit" msgstr "日志大小上限" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:45 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:48 msgid "Scheduled Clear Size Limit Unit" msgstr "日志大小上限单位" @@ -469,16 +485,16 @@ msgstr "定时重启" msgid "Scheduled Restart Cron" msgstr "Cron 表达式" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:80 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:113 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:83 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/log.js:116 msgid "Scroll To Bottom" msgstr "滚动到底部" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:157 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:163 msgid "Stack Size Hard Limit" msgstr "栈大小硬限制" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:153 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:159 msgid "Stack Size Soft Limit" msgstr "栈大小软限制" @@ -561,12 +577,14 @@ msgstr "UI 下载地址" msgid "UI Path" msgstr "UI 路径" -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:139 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:143 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:147 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:151 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:155 -#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:159 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:145 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:149 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:153 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:157 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:161 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:165 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:177 +#: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:181 msgid "Unlimited" msgstr "无限制" @@ -626,35 +644,3 @@ msgstr "用户代理(UA)" #: applications/luci-app-momo/htdocs/luci-static/resources/view/momo/app.js:128 msgid "procd Config" msgstr "procd 配置" - -#~ msgid "Cron Expression" -#~ msgstr "Cron 表达式" - -#~ msgid "Check log size at the configured cron schedule before cleaning up." -#~ msgstr "按设定的 Cron 周期检查日志大小,满足条件后再清理。" - -#~ msgid "" -#~ "Clear app, core and debug logs when their total size reaches this " -#~ "threshold." -#~ msgstr "当插件日志、核心日志和调试日志总大小达到该阈值时自动清理。" - -#~ msgid "Log Cleanup" -#~ msgstr "日志清理" - -#~ msgid "Log Cleanup Cron Expression" -#~ msgstr "日志清理 Cron 表达式" - -#~ msgid "Log Cleanup Size Threshold (MB)" -#~ msgstr "日志清理大小阈值(MB)" - -#~ msgid "Log Size Check Cron Expression" -#~ msgstr "日志大小检查 Cron 表达式" - -#~ msgid "Run unconditional log cleanup at the configured cron schedule." -#~ msgstr "按设定的 Cron 时间无条件执行日志清理。" - -#~ msgid "Scheduled Log Cleanup" -#~ msgstr "定时日志清理" - -#~ msgid "Size-based Log Cleanup" -#~ msgstr "按大小触发日志清理" diff --git a/momo/Makefile b/momo/Makefile index c6609c69..b361697c 100644 --- a/momo/Makefile +++ b/momo/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=momo -PKG_VERSION:=2026.04.09 -PKG_RELEASE:=8 +PKG_VERSION:=2026.06.03 +PKG_RELEASE:=9 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Joseph Mory diff --git a/momo/files/momo.conf b/momo/files/momo.conf index a709d49b..fd86b011 100644 --- a/momo/files/momo.conf +++ b/momo/files/momo.conf @@ -121,6 +121,7 @@ config routing 'routing' option 'dummy_device' 'momo-dummy' config log 'log' + option 'clear_at_stop' '1' option 'scheduled_clear' '1' option 'scheduled_clear_cron' '*/5 * * * *' option 'scheduled_clear_size_limit' '1' diff --git a/momo/files/momo.init b/momo/files/momo.init index a8ea4de7..d94244e6 100644 --- a/momo/files/momo.init +++ b/momo/files/momo.init @@ -67,7 +67,9 @@ start_service() { local fast_reload config_get_bool fast_reload "procd" "fast_reload" 0 ### rlimit - local rlimit_address_space_soft rlimit_address_space_hard rlimit_data_soft rlimit_data_hard rlimit_stack_soft rlimit_stack_hard rlimit_nofile_soft rlimit_nofile_hard + local rlimit_nproc_soft rlimit_nproc_hard rlimit_address_space_soft rlimit_address_space_hard rlimit_data_soft rlimit_data_hard rlimit_stack_soft rlimit_stack_hard rlimit_nofile_soft rlimit_nofile_hard + config_get rlimit_nproc_soft "procd" "rlimit_nproc_soft" "$(ulimit -Su)" + config_get rlimit_nproc_hard "procd" "rlimit_nproc_hard" "$(ulimit -Hu)" config_get rlimit_address_space_soft "procd" "rlimit_address_space_soft" config_get rlimit_address_space_hard "procd" "rlimit_address_space_hard" config_get rlimit_data_soft "procd" "rlimit_data_soft" @@ -76,6 +78,10 @@ start_service() { config_get rlimit_stack_hard "procd" "rlimit_stack_hard" config_get rlimit_nofile_soft "procd" "rlimit_nofile_soft" "$(ulimit -Sn)" config_get rlimit_nofile_hard "procd" "rlimit_nofile_hard" "$(ulimit -Hn)" + ### environment variable + local env_go_max_procs env_go_mem_limit + config_get env_go_max_procs "procd" "env_go_max_procs" + config_get env_go_mem_limit "procd" "env_go_mem_limit" ## core config local redirect_inbound_tag tproxy_inbound_tag tun_inbound_tag dns_inbound_tag fake_ip_dns_server_tag config_get redirect_inbound_tag "core" "redirect_inbound_tag" @@ -133,6 +139,8 @@ start_service() { log "Mixin" "Mixin config." ucode -S "$MIXIN_UC" fi + # format profile + $PROG -c "$RUN_PROFILE_PATH" format -w # check profile if [ "$core_only" = 0 ] && [ "$proxy_enabled" = 1 ]; then log "Profile" "Checking..." @@ -197,11 +205,16 @@ start_service() { fi procd_set_param pidfile "$PID_FILE_PATH" procd_set_param respawn + + procd_append_param limits nproc="${rlimit_nproc_soft} ${rlimit_nproc_hard}" procd_append_param limits as="${rlimit_address_space_soft:-unlimited} ${rlimit_address_space_hard:-unlimited}" procd_append_param limits data="${rlimit_data_soft:-unlimited} ${rlimit_data_hard:-unlimited}" procd_append_param limits stack="${rlimit_stack_soft:-unlimited} ${rlimit_stack_hard:-unlimited}" procd_append_param limits nofile="${rlimit_nofile_soft} ${rlimit_nofile_hard}" + procd_append_param env GOMAXPROCS="$env_go_max_procs" + procd_append_param env GOMEMLIMIT="$env_go_mem_limit" + procd_close_instance # cron local reload_cron; reload_cron=0 @@ -379,11 +392,20 @@ cleanup() { # load config config_load momo # get config + ## log config + local log_clear_at_stop + config_get_bool log_clear_at_stop "log" "clear_at_stop" 0 ## routing config local tproxy_route_table tun_route_table dummy_device config_get tproxy_route_table "routing" "tproxy_route_table" "80" config_get tun_route_table "routing" "tun_route_table" "81" config_get dummy_device "routing" "dummy_device" "momo-dummy" + # clear logs if needed + if [ "$log_clear_at_stop" = 1 ]; then + echo -n > "$APP_LOG_PATH" + echo -n > "$CORE_LOG_PATH" + log "Log" "Logs are cleared due to clear at stop is enabled." + fi # delete routing policy ip -4 rule del table "$tproxy_route_table" > /dev/null 2>&1 ip -4 rule del table "$tun_route_table" > /dev/null 2>&1 diff --git a/momo/files/uci-defaults/migrate.sh b/momo/files/uci-defaults/migrate.sh index 9dab7d1c..11cb9414 100644 --- a/momo/files/uci-defaults/migrate.sh +++ b/momo/files/uci-defaults/migrate.sh @@ -51,6 +51,9 @@ section_mixin=$(uci -q get momo.mixin); [ -z "$section_mixin" ] && { uci set momo.mixin.external_control_ui_download_url='https://github.com/Zephyruso/zashboard/releases/latest/download/dist-cdn-fonts.zip' } +# since v1.2.1 +config_clear_at_stop=$(uci -q get momo.log.clear_at_stop); [ -z "$config_clear_at_stop" ] && uci set momo.log.clear_at_stop=1 + # commit uci commit momo diff --git a/momo/files/ucode/hijack.ut b/momo/files/ucode/hijack.ut index 9baa1a73..31ddaa0e 100644 --- a/momo/files/ucode/hijack.ut +++ b/momo/files/ucode/hijack.ut @@ -248,6 +248,7 @@ table inet momo { } {% if (router_proxy): %} + {% if (length(dns_hijack_nfproto) > 0): %} chain router_dns_hijack { {% for (let access_control in router_access_control): %} {% if (length(access_control['user']) == 0 && length(access_control['group']) == 0 && length(access_control['cgroup']) == 0): %} @@ -267,6 +268,7 @@ table inet momo { {% endif %} {% endfor %} } + {% endif %} {% if (tcp_mode == 'redirect'): %} chain router_redirect { @@ -360,6 +362,7 @@ table inet momo { {% endif %} {% if (lan_proxy): %} + {% if (length(dns_hijack_nfproto) > 0): %} chain lan_dns_hijack { {% for (let access_control in lan_access_control): %} {% if (length(access_control['ip']) == 0 && length(access_control['ip6']) == 0 && length(access_control['mac']) == 0): %} @@ -381,6 +384,7 @@ table inet momo { {% endif %} {% endfor %} } + {% endif %} {% if (tcp_mode == 'redirect'): %} chain lan_redirect {