luci-app-sqm: displays a list of scripts and descriptions based on iptables system functions

Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
sbwml 2025-05-27 19:08:41 +08:00
parent 1f926d3e21
commit e85f3d273b
2 changed files with 60 additions and 19 deletions

View File

@ -8,13 +8,6 @@
'require tools.widgets as widgets';
return view.extend({
handleGetHelpText: function(script_name, tbl) {
return fs.read("/usr/lib/sqm/" + script_name + ".help").then(function (text) {
if (text)
return [script_name, text];
});
},
handleEnableSQM: rpc.declare({
object: 'luci',
method: 'setInitAction',
@ -26,13 +19,11 @@ return view.extend({
return Promise.all([
L.resolveDefault(fs.list('/var/run/sqm/available_qdiscs'), []),
L.resolveDefault(fs.list('/usr/lib/sqm'), []).then(L.bind(function(scripts) {
var tasks = [], scriptHelpTbl = {};
var result = [];
for (var i = 0; i < scripts.length; i++)
if (scripts[i].name.search(/\.qos$/) != -1)
tasks.push(L.resolveDefault(this.handleGetHelpText(scripts[i].name, scriptHelpTbl), [scripts[i].name, null]));
return Promise.all(tasks);
result.push([scripts[i].name]);
return result;
}, this)),
uci.load('sqm')
]);
@ -117,14 +108,31 @@ return view.extend({
o.rmempty = false;
var qos_desc = "";
var hasIptables = L.hasSystemFeature('iptables');
var helpTexts = {
"layer_cake.qos": _("This uses the cake qdisc as a replacement for both htb as shaper and fq_codel as leaf qdisc.") + "<br />"
+ _("This exercises cake's diffserv profile(s) as different \"layers\" of priority.") + "<br />"
+ _("This script requires that cake is selected as qdisc, and forces its usage.") + "<br />"
+ _("See:") + " http://www.bufferbloat.net/projects/codel/wiki/Cake " + _("for more information"),
"piece_of_cake.qos": _("This just uses the cake qdisc as a replacement for both htb as shaper and fq_codel as leaf qdisc.") + "<br />"
+ _("It just does not come any simpler than this, in other words it truely is a \"piece of cake\".") + "<br />"
+ _("This script requires that cake is selected as qdisc, and forces its usage.") + "<br />"
+ _("See:") + " http://www.bufferbloat.net/projects/codel/wiki/Cake " + _("for more information"),
"simple.qos": _("BW-limited three-tier prioritisation scheme with your qdisc on each queue."),
"simplest.qos": _("Simplest possible configuration: HTB rate limiter with your qdisc attached."),
"simplest_tbf.qos": _("Simplest possible configuration (TBF): TBF rate limiter with your qdisc attached.") + "<br />"
+ _("TBF may give better performance than HTB on some architectures. This script forces fq_codel usage if cake is selected as qdisc.")
};
o = s.taboption("tab_qdisc", form.ListValue, "script", _("Queue setup script"));
for (i = 0; i < scripts.length; i++) {
o.value(scripts[i][0]);
qos_desc += "<p><b>" + scripts[i][0] + ":</b><br />";
if (scripts[i][1])
qos_desc += scripts[i][1] + "</p>";
else
qos_desc += "No help text</p>";
for (var i = 0; i < scripts.length; i++) {
var scriptName = scripts[i][0];
if (!hasIptables && scriptName.indexOf("simple") === 0) {
continue;
}
o.value(scriptName);
qos_desc += "<b>" + scriptName + ":</b><br />";
if (helpTexts[scriptName])
qos_desc += helpTexts[scriptName] + "</br></br>";
}
o.default = "piece_of_cake.qos";
o.rmempty = false;

View File

@ -304,3 +304,36 @@ msgstr ""
#: applications/luci-app-sqm/htdocs/luci-static/resources/view/network/sqm.js:219
msgid "default"
msgstr "默认"
msgid "This uses the cake qdisc as a replacement for both htb as shaper and fq_codel as leaf qdisc."
msgstr "该脚本使用 cake 队列规则qdisc来替代 htb分层令牌桶作为流量整形器同时取代 fq_codel 作为叶节点队列规则。"
msgid "This exercises cake's diffserv profile(s) as different \"layers\" of priority."
msgstr "它通过 cake 的差异化服务diffserv策略来模拟不同"层级"的流量优先级。"
msgid "This script requires that cake is selected as qdisc, and forces its usage."
msgstr "该脚本要求并强制使用 cake 作为队列规则qdisc。"
msgid "See:"
msgstr "参考:"
msgid "for more information"
msgstr "了解更多信息"
msgid "This just uses the cake qdisc as a replacement for both htb as shaper and fq_codel as leaf qdisc."
msgstr "该脚本仅使用 cake 队列规则qdisc同时替代 htb 作为整形器和 fq_codel 作为叶队列规则。"
msgid "It just does not come any simpler than this, in other words it truely is a \"piece of cake\"."
msgstr "这已经是最简单的配置了,换句话说,这真的是“小菜一碟”。"
msgid "BW-limited three-tier prioritisation scheme with your qdisc on each queue."
msgstr "带宽受限的三层优先级方案,每个队列都可使用您选择的 qdisc。"
msgid "Simplest possible configuration: HTB rate limiter with your qdisc attached."
msgstr "最简单的配置HTB 限速器,并绑定您选择的 qdisc。"
msgid "Simplest possible configuration (TBF): TBF rate limiter with your qdisc attached."
msgstr "最简单的配置TBFTBF 限速器,并绑定您选择的 qdisc。"
msgid "TBF may give better performance than HTB on some architectures. This script forces fq_codel usage if cake is selected as qdisc."
msgstr "在某些架构上TBF 可能比 HTB 有更好的性能。当 cake 被选为 qdisc 时,该脚本会强制使用 fq_codel。"