From 2d3b37888d2069da879507d5b304239a921673a8 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Tue, 8 Aug 2023 12:51:50 +0200 Subject: [PATCH] Add automatic speedtest in wizard --- .../luasrc/controller/openmptcprouter.lua | 7 +++- .../luasrc/view/openmptcprouter/wizard.htm | 18 ++++++-- .../share/omr/post-tracking.d/post-tracking | 42 +++++++++++++++++++ 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 592abcc89..b760b205c 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -415,6 +415,7 @@ function wizard_add() local downloadspeed = luci.http.formvalue("cbid.sqm.%s.download" % intf) or "0" local uploadspeed = luci.http.formvalue("cbid.sqm.%s.upload" % intf) or "0" + local testspeed = luci.http.formvalue("cbid.sqm.%s.testspeed" % intf) or "0" if not ucic:get("qos",intf) ~= "" then ucic:set("qos",intf,"interface") @@ -438,7 +439,7 @@ function wizard_add() ucic:set("sqm",intf,"script","piece_of_cake.qos") ucic:set("sqm",intf,"qdisc_advanced","0") ucic:set("sqm",intf,"linklayer","atm") - ucic:set("sqm",intf,"overhead","40") + ucic:set("sqm",intf,"overhead","44") ucic:set("sqm",intf,"enabled","0") ucic:set("sqm",intf,"debug_logging","0") ucic:set("sqm",intf,"verbosity","5") @@ -454,6 +455,10 @@ function wizard_add() ucic:set("sqm",intf,"qdisc","cake") ucic:set("sqm",intf,"script","piece_of_cake.qos") end + ucic:set("openmptcprouter",intf,"testspeed",testspeed) + if testspeed == "1" then + ucic:set("openmptcprouter",intf,"testspeed_lc") + end if downloadspeed ~= "0" and downloadspeed ~= "" then if sqmautorate == "1" and (ucic:get("network",intf,"downloadspeed") ~= downloadspeed or ucic:get("sqm",intf,"max_download") == "" or ucic:get("sqm",intf,"download") == "0") then ucic:set("sqm",intf,"download",math.ceil(downloadspeed*65/100)) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index 6b005fe5b..159c22fc5 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -272,7 +272,7 @@ local method=uci:get("openmptcprouter","settings","encryption") if method == nil and ut.trim(sys.exec("cat /proc/cpuinfo | grep aes")) ~= "" then method="aes-256-gcm" - else + elseif method == nil then method="chacha20" end %> @@ -993,12 +993,22 @@ end %>
+ +
+ checked<% end %> /> +
+
+ <%:Run an automatic speedtest to calculate max speed.%> +
+
+
+

- <%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%> + <%:Used by Glorytun UDP and SQM/QoS if enabled.%>
-
+

- <%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%> + <%:Used by Glorytun UDP and SQM/QoS if enabled.%>