mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 18:41:51 +00:00
Add MPTCP fullmesh info in interface
This commit is contained in:
parent
08f6f0b6b2
commit
42a8d0317c
2 changed files with 66 additions and 0 deletions
|
@ -13,6 +13,8 @@ function index()
|
|||
entry({"admin", "network", "mptcp", "interface_bandwidth"}, call("interface_bandwidth")).leaf = true
|
||||
entry({"admin", "network", "mptcp", "mptcp_check"}, template("mptcp/mptcp_check"), _("MPTCP Support Check"), 4).leaf = true
|
||||
entry({"admin", "network", "mptcp", "mptcp_check_trace"}, post("mptcp_check_trace")).leaf = true
|
||||
entry({"admin", "network", "mptcp", "mptcp_fullmesh"}, template("mptcp/mptcp_fullmesh"), _("MPTCP Fullmesh"), 4).leaf = true
|
||||
entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true
|
||||
end
|
||||
|
||||
function interface_bandwidth(iface)
|
||||
|
@ -80,3 +82,18 @@ function mptcp_check_trace(iface)
|
|||
end
|
||||
return
|
||||
end
|
||||
|
||||
function mptcp_fullmesh_data()
|
||||
luci.http.prepare_content("text/plain")
|
||||
local fullmash
|
||||
fullmesh = io.popen("multipath -f")
|
||||
if fullmesh then
|
||||
while true do
|
||||
local ln = fullmesh:read("*l")
|
||||
if not ln then break end
|
||||
luci.http.write(ln)
|
||||
luci.http.write("\n")
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
|
49
luci-app-mptcp/luasrc/view/mptcp/mptcp_fullmesh.htm
Normal file
49
luci-app-mptcp/luasrc/view/mptcp/mptcp_fullmesh.htm
Normal file
|
@ -0,0 +1,49 @@
|
|||
<%+header%>
|
||||
|
||||
<%
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local sys = require "luci.sys"
|
||||
local ifaces = sys.net:devices()
|
||||
local net = require "luci.model.network".init()
|
||||
%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.193.28471-ee087a1"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var stxhr = new XHR();
|
||||
|
||||
function update_fullmesh()
|
||||
{
|
||||
var fm = document.getElementById('fullmesh');
|
||||
|
||||
if (fm)
|
||||
{
|
||||
fm.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' + '<%:Waiting for command to complete...%>'
|
||||
;
|
||||
|
||||
stxhr.post('<%=url('admin/network/mptcp')%>/mptcp_fullmesh_data/', { token: '<%=token%>' },
|
||||
function(x)
|
||||
{
|
||||
if (x.responseText)
|
||||
{
|
||||
fm.innerHTML = String.format('<pre>%s</pre>', x.responseText );
|
||||
} else {
|
||||
fm.innerHTML = '<pre><%:Error%></pre>';
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
setInterval(function () {
|
||||
update_fullmesh();
|
||||
}, 10000);
|
||||
//]]></script>
|
||||
|
||||
<% if stderr and #stderr > 0 then %><pre class="error"><%=pcdata(stderr)%></pre><% end %>
|
||||
<div class="cbi-section">
|
||||
<span id="fullmesh"></span>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
update_fullmesh();
|
||||
//]]></script>
|
||||
</div>
|
||||
<%+footer%>
|
Loading…
Reference in a new issue