From 144e0f45b9a9e40fe5f0bfc916fbc729cc6ed52a Mon Sep 17 00:00:00 2001 From: Ycarus Date: Wed, 28 Mar 2018 10:57:02 +0200 Subject: [PATCH] Add OpenMPTCProuter status view --- luci-app-openmptcprouter/Makefile | 2 +- .../htdocs/luci-static/resources/computer.png | Bin 0 -> 1101 bytes .../htdocs/luci-static/resources/modem.svg | 52 +++ .../openmptcprouter/css/wanstatus.css | 304 ++++++++++++++++++ .../openmptcprouter/images/status-doing.png | Bin 0 -> 536 bytes .../openmptcprouter/images/status-done.png | Bin 0 -> 607 bytes .../openmptcprouter/images/status-error.png | Bin 0 -> 575 bytes .../openmptcprouter/images/status-todo.png | Bin 0 -> 536 bytes .../openmptcprouter/images/status-warn.png | Bin 0 -> 544 bytes .../openmptcprouter/images/statusError.png | Bin 0 -> 1717 bytes .../openmptcprouter/images/statusOK.png | Bin 0 -> 1637 bytes .../openmptcprouter/images/statusWarning.png | Bin 0 -> 1323 bytes .../luci-static/resources/overthebox.png | Bin 0 -> 1677 bytes .../luasrc/controller/openmptcprouter.lua | 148 ++++++++- .../luasrc/view/openmptcprouter/wanstatus.htm | 284 ++++++++++++++++ 15 files changed, 787 insertions(+), 3 deletions(-) create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/computer.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/modem.svg create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-doing.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-done.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-error.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-todo.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-warn.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/statusError.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/statusOK.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/statusWarning.png create mode 100644 luci-app-openmptcprouter/htdocs/luci-static/resources/overthebox.png create mode 100644 luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm diff --git a/luci-app-openmptcprouter/Makefile b/luci-app-openmptcprouter/Makefile index 9ff51ec70..4f768cfbb 100644 --- a/luci-app-openmptcprouter/Makefile +++ b/luci-app-openmptcprouter/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI Support for OpenMPTCProuter - +LUCI_DEPENDS:=+luci-lib-json PKG_LICENSE:=Apache-2.0 include ../luci/luci.mk diff --git a/luci-app-openmptcprouter/htdocs/luci-static/resources/computer.png b/luci-app-openmptcprouter/htdocs/luci-static/resources/computer.png new file mode 100644 index 0000000000000000000000000000000000000000..4598c7cb644bf2f2cc53b4fb0f07af6b55ba80b4 GIT binary patch literal 1101 zcmV-T1hV^yP)^3pt4vl zmt~g=25q1P@LT{7BS`CoN=CpJdxIv(GrkD`chVD;nJ>bi^o(wfSYVCS7c z6J)NHtA?hs5RYQ5=*FvaCrC_Ed3i}CZL!kN+DdjnH$?KYG>rm*yY0JXQY_$~Tvj#E z;>ll(iyr8r40ui89O1d)0Bj?d#O;+2VpT(#rx^gUM`D|)w0KuT$=2!-?XirVNR}GR z0#5g;K5AY?s}rcDF}`@ul@Y7KNX?TC$b9@;DkRjDk3rsZ5mGlU4$f@Cl93<+Oi>BxnJ&M_f zlt)+n(^y4zR@nvzD4n}j4zUHT4ZN_z--S#!oCKC#6aqXKK35HVxKq4wjz@71KdLpC zfYZ5GBMlz51ZonC|7x{a!72({W#0=pqDP)2ye&x&eUQ={G;{<3G(ZD11keBt&_Dpt z01W{&Km#-c&;ShqG(ZD11keBt0W?4ZGz8FrgO+K&!D^qsf8U5s0uRsxppT>Ue}UHP zGqO@lc@k>`|UQS<;72)FkY42As;Ohr;-E-gf;(mk;5^iSi-tJZgUZL%u}F zHuBWA4!nx!l~H?El=5WjH4?QQOYJlvKlV&Py)>e_luiJ!C6bwky9CbBsH;bhJQh+) zB|Jp`*4u>|#k|PX2ieNX$_wY>E0wT!M|1GY)z-(YbqBgR_F+_W8= zZ+|7IdDJ+y_P+BzCZ&_vCO$^H&!Qn)U#&=Pjc6l3oJIb<@In^vIFq%l47y+FUQm)=Po=}QidoGIvxiXYmi$M|f_>o}4C8lV9h0%(8+ zXdnP+fQI_(;3GpCeQnMO(4j`Jh-g>`KtreC(GA|sk5x}?rNC>~|8@0N{S{yUhmwBH TVtM*500000NkvXXu0mjfCtLLG literal 0 HcmV?d00001 diff --git a/luci-app-openmptcprouter/htdocs/luci-static/resources/modem.svg b/luci-app-openmptcprouter/htdocs/luci-static/resources/modem.svg new file mode 100644 index 000000000..338d44192 --- /dev/null +++ b/luci-app-openmptcprouter/htdocs/luci-static/resources/modem.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css b/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css new file mode 100644 index 000000000..fbddd23be --- /dev/null +++ b/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/css/wanstatus.css @@ -0,0 +1,304 @@ +.container { + /* container for entire page. fixes bootstrap theme's ridiculously small page width */ + max-width: 1044px; +} +#interface_field { + padding: 12px 20px 20px 20px; +} +#mwan_status_text { + display: table; + font-size: 14px; + margin: auto; + max-width: 1044px; + min-width: 246px; + width: 100%; +} +.wanon { + background-color: #1cc82c; +} +.wanoff { + background-color: #e55712; +} +.wanon, +.wanoff { + border-radius: 60px; + box-shadow: 0px 2px 5px -3px; + float: left; + margin: 8px 3px 0px 3px; + min-height: 30px; + min-width: 235px; + padding: 5px 10px 8px 10px; + text-align: center; +} +/* Mwan3 ligthed CSS */ +.container { + /* container for entire page. fixes bootstrap theme's ridiculously small page width */ + max-width: 1044px; +} +#interface_field { + padding: 0px; +} +#interface_field td { + padding: 0px; +} +#interface_status_text { + display: table; + font-size: 14px; + margin: auto; + max-width: 1044px; + min-width: 246px; + width: 100%; +} +ul { + margin: 0px; +} +/*Now the CSS*/ +.tree ul { + position: relative; + float: left; + transition: all 0.5s; + -webkit-transition: all 0.5s; + -moz-transition: all 0.5s; +} +.tree li { + float: left; + text-align: left; + list-style-type: none; + position: relative; + padding: 5px 0px 5px 85px; + transition: all 0.5s; + -webkit-transition: all 0.5s; + -moz-transition: all 0.5s; +} +.tree ul ul { + padding-left: 85px; + position: relative; +} +.tree > ul > li:first-child { + position: relative; + padding-left: 0px; +} +.tree > ul > li#first-child > a { + position: relative; + top: 50%; +} +/*We will use ::before and ::after to draw the connectors + Before: Bottom part of the element + After: Top part of the element +*/ +.tree ul ul li::before, +.tree ul ul li::after { + content: ''; + position: absolute; + top: 50%; + left: 0; + border-left: 2px solid black; + width: 85px; + height: 50%; + float: left; + z-index: -10; + /* + position: absolute; + top: 0; + right: 50%; + border-top: 2px solid black; + width: 50%; + height: 20px; + background-color: red; +*/ +} +.tree ul ul li::after { + top: auto; + bottom: 50%; + border-left: 2px solid black; + border-bottom: 2px solid black; +} +.tree li:first-child { + position: relative; + top: 50%; +} +/*We need to remove first top and the last bottom border */ +.tree li:only-child::after { + display: none; +} +/*Remove space from the top of single children*/ +.tree li:only-child { + padding-top: 0; +} +/*Remove left connector from first child and +right connector from last child*/ +.tree li:first-child::after, +.tree li:last-child::before { + border-left: 0px; +} +/*Adding back the vertical connector to the last nodes*/ +/* +.tree li:last-child::before{ + //border-top: 2px solid black; + border-radius: 0 5px 0 0; + -webkit-border-radius: 0 5px 0 0; + -moz-border-radius: 0 5px 0 0; +} +.tree li:first-child::after{ + border-radius: 5px 0 0 0; + -webkit-border-radius: 5px 0 0 0; + -moz-border-radius: 5px 0 0 0; +} +*/ +/*Time to add right connectors from parents*/ +.tree ul ul::before { + content: ''; + position: absolute; + top: 50%; + left: 0; + border-top: 2px solid black; + width: 85px; + height: 100%; +} +.tree li a { + display: inline-block; + background-color: #f3f3f3; + text-decoration: none; + /* + border: 1px solid @color-bg-gray; + padding: 5px 10px; + + font-family: arial, verdana, tahoma; + font-size: 11px; + + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + + transition: all 0.5s; + -webkit-transition: all 0.5s; + -moz-transition: all 0.5s; + */ +} +/*Exception*/ +.tree li.remote-from-lease { + padding-bottom: 0px; +} +.tree li.remote-from-lease::before, +.tree li#networkRootNode::before { + display: none; +} +.tree li#networkRootNode::after { + border: none; +} +.tree li.remote-from-lease::after { + content: ''; + position: absolute; + left: 50%; + top: 83px; + border-left: 2px solid black; + border-bottom: none; + width: 2px; + height: 30px; + z-index: -10; +} +.tree li#networkRootNode { + padding: 25px 0 0 0; +} +.tree li.subnode-only-child::before { + content: ''; + position: absolute; + top: 50%; + left: 0; + border-top: 2px solid black; + width: 85px; + height: 0; +} +.tree ul li#networkRootNode:not(:first-child) td::before { + content: ''; + position: absolute; + top: 0; + border-left: 2px solid black; + border-bottom: none; + width: 2px; + height: 50%; + left: 200px; + z-index: -10; +} +/*Time for some hover effects*/ +/*We will apply the hover effect the the lineage of the element also*/ +/* +.tree li a:hover, .tree li a:hover+ul li a { + background: #c8e4f8; color: #000; border: 1px solid #94a0b4; +} +.tree li a:hover+ul li::after, +.tree li a:hover+ul li::before, +.tree li a:hover+ul::before, +.tree li a:hover+ul ul::before{ + border-color: #94a0b4; +} +*/ +/*Thats all. I hope you enjoyed it. +Thanks :)*/ +.network-node { + position: relative; + background-color: #f3f3f3; + padding: 12px; + width: 400px; + max-width: 400px; + box-sizing: border-box; +} +.network-node .equipment-icon { + position: relative; + float: left; + width: 64px; + max-width: 64px; + box-sizing: border-box; +} +.network-node .equipment-icon emded, +.network-node .equipment-icon img { + width: 64px; + max-width: 64px; +} +.network-node .equipment-icon img { + position: relative; + top: 10px; +} +.network-node .status-icon { + position: relative; + float: left; + width: 30px; + max-width: 30px; + margin-left: 24px; + margin-rigth: 8px; + top: 20px; + box-sizing: border-box; +} +.network-node .status-icon img { + max-width: 30px; + width: 30px; +} +.network-node .info { + position: relative; + float: right; + width: 250px; + text-align: left; + font-size: 12px; + color: #757575; +} +.network-node .info .title { + display: block; + font-size: 17px; + font-weight: 700; + color: #333333; +} +.network-node .info .status-message { + display: block; +} +.network-node .info .status-message.error { + color: #e55712; +} +.network-node .info .status-message.warning { + color: #eb9e10; +} +.network-node .info .content { + display: block; +} +#networkRootNode table td { + border-top: 0px; +} \ No newline at end of file diff --git a/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-doing.png b/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/status-doing.png new file mode 100644 index 0000000000000000000000000000000000000000..e71747272e631c618eb4446f9644552c154f18cb GIT binary patch literal 536 zcmV+z0_XjSP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGqB>(^xB>_oNB=7(L0j)_yK~y+Tl~YSE z15p^A|AcsKM6e{mLI{FHY*f(oVWOz*tv zbUGSFo7R_;%*~y1zWd$po{!SFN!ENgZ7w-L1DV3->NVg`AwbL2g{dN=*lp*=X_6FO zcCOecQl6J!{ie|GOrjZ~Nu@~ynZj8$>%#U86FoOkfLdUXu!snHo!l5r#>n`7J<)@EA89H@0alN5Eg0eq8BTPl` z{2r*?5E?AP+9lg*vJXq-c+#$Oj5lrU`ypT6=1%yRoQ$v4!%|WjtfiyW`V*?q&`6C%0EZc aO}+r@R{dU2(fYvv0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGqB>(^xB>_oNB=7(L0rW{kK~y+Tos>&U z8&MdB=Z8q$xUtxTqKisZyif!SEx1tErWB!&RzXoKc%jfL#f6|?p@^GeOOftfRH%j6 zNi=G1(~Kt3XiYRG>HGno$vMVk)Ta0@hVQ)J^OBQuQ;cG*Cf0hj*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17=zjd{6*n-&> zNWQDhE_51)1&h~1g$5EsJSs~HN@NEI$?`ceO{W8fMqtS)LrgYt)i?}LLXJQ{Id&@d%h2ym)@+kHZN zCu+<$(yfkcKcN{lZmQF`?I$#Q+}BHuYY`d>j!&o&>6sXyT{i%YXaeTZsfU5gq?vi& z@E$lFw7a&K_I+p^Plg|$J*n$fEkRqgt@%E{sWIQJZ+M|W^92qQZ}38d=F?O+O~4Bk znip`eBD(MmFBE97G3P_b79nxUtZR7e{aL7*2IGAJS75nVSMcC{mjOW=xti*vE3*xB z=cj6c8v#xYC&o3^xDvd8x69736fDAWQ;kEc0`JZRUf_F-Cs^DX!PA^W-3bDN2ZJ`k z3mFJgr#Ls!(ByE8g6f{^aQzMKVi{tX9!5QH3&?U58pNVNDNCrm{b6qtEkDo8N zhu5Iaf=P7+REv1+4&`SO-;E}t((>jhI=Y0GMnb6Ts1=` ziS!7yZERx@A*qtOp>E!kuL}^`2pRtYnK;qa5lrhc-3gNcn&^jp(AdNkX%ckogh@JZ zZR5WD67g;5xJ_rd)Xg`SzO#wIOq4pta(Zx}b(mkHwsV|46^cv<_oiL!SjtJG9efzMB7uYlzd#t{--vCQOk_!ogvlO;2G6j7dgZbs)wO&E z_iIncuX0+t_j=Uorv?wr(WgtGK9Gj&Z5?D+-LhRFAH*XBf1K zw*|Dh2m;gm8es=16M|vZbrvYF>+O0UP$|Lw!+Qf%9 zU9wyFo>c`+sUpG+(54S6pR`q7Un&$Y+SC)Mg1i-EZtb|}Nf&>XKrv|nRP|-Dh(AR@ j$Xi+OqRSllp8x{@?66g33*-8n00000NkvXXu0mjf3mop% literal 0 HcmV?d00001 diff --git a/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/statusWarning.png b/luci-app-openmptcprouter/htdocs/luci-static/resources/openmptcprouter/images/statusWarning.png new file mode 100644 index 0000000000000000000000000000000000000000..29ee04f01634803d9b035c0fd1ef0aaf8b1145b9 GIT binary patch literal 1323 zcmV+`1=RY9P)75q00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vucH&f;N}vHd=Ql6m@#qQTPg;TGBK!n&j0#%@d~5}i z=}-p@3_Zo840s7UMm~#SEzmFcc$SF3)xf7X?>sBC(hbLfHNZnad0aIF zD%>8HyK(ziTEZl6?J-VfDgj5l0vzz=dCWJvTMF5=%L`a<4&l}%*Lk6bw&KTssj7dQ zhQW%{(n@kfRX=MFTk$;H*8a2$2lXauLEfWf&gdIkbmQ1F+VhDWxo5%}Caht?8tucs X;o;M8_(@hl00000NkvXXu0mjfbF&e- literal 0 HcmV?d00001 diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 8b40669dd..1d589bc82 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -1,3 +1,6 @@ +local tools = require "luci.tools.status" +local sys = require "luci.sys" +local json = require("luci.json") local ucic = uci.cursor() module("luci.controller.openmptcprouter", package.seeall) @@ -5,8 +8,11 @@ function index() -- entry({"admin", "openmptcprouter"}, firstchild(), _("OpenMPTCProuter"), 19).index = true -- entry({"admin", "openmptcprouter", "wizard"}, template("openmptcprouter/wizard"), _("Wizard"), 1).leaf = true -- entry({"admin", "openmptcprouter", "wizard_add"}, post("wizard_add")).leaf = true - entry({"admin", "system", "openmptcprouter"}, template("openmptcprouter/wizard"), _("Settings Wizard"), 1) + entry({"admin", "system", "openmptcprouter"}, alias("admin", "system", "openmptcprouter", "wizard"), _("OpenMPTCProuter")) + entry({"admin", "system", "openmptcprouter", "wizard"}, template("openmptcprouter/wizard"), _("Settings Wizard"), 1) entry({"admin", "system", "openmptcprouter", "wizard_add"}, post("wizard_add")) + entry({"admin", "system", "openmptcprouter", "status"}, template("openmptcprouter/wanstatus"), _("Status"), 2).leaf = true + entry({"admin", "system", "openmptcprouter", "interfaces_status"}, call("interfaces_status")).leaf = true end function wizard_add() @@ -47,6 +53,144 @@ function wizard_add() ucic:commit("network") luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null") luci.sys.call("/etc/init.d/glorytun restart >/dev/null 2>/dev/null") - luci.http.redirect(luci.dispatcher.build_url("admin/network/network")) + luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/status")) return +end + +-- This function come from OverTheBox by OVH with very small changes +function interfaces_status() + local ut = require "luci.util" + local ntm = require "luci.model.network".init() + local uci = require "luci.model.uci".cursor() + + local mArray = {} + + -- OpenMPTCProuter info + mArray.openmptcprouter = {} + mArray.openmptcprouter["version"] = ut.trim(sys.exec("cat /etc/os-release | grep VERSION= | sed -e 's:VERSION=::'")) + -- Check that requester is in same network + mArray.openmptcprouter["service_addr"] = uci:get("shadowsocks", "proxy", "server") or "0.0.0.0" + mArray.openmptcprouter["local_addr"] = uci:get("network", "lan", "ipaddr") + mArray.openmptcprouter["wan_addr"] = "0.0.0.0" + + -- wanaddr + mArray.openmptcprouter["wan_addr"] = sys.exec("wget -4 -qO- -T 1 http://ip.openmptcprouter.com") + + mArray.openmptcprouter["remote_addr"] = luci.http.getenv("REMOTE_ADDR") or "" + mArray.openmptcprouter["remote_from_lease"] = false + local leases=tools.dhcp_leases() + for _, value in pairs(leases) do + if value["ipaddr"] == mArray.openmptcprouter["remote_addr"] then + mArray.openmptcprouter["remote_from_lease"] = true + mArray.openmptcprouter["remote_hostname"] = value["hostname"] + end + end + + -- Check openmptcprouter service are running + mArray.openmptcprouter["tun_service"] = false + if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") then + mArray.openmptcprouter["tun_service"] = true + end + mArray.openmptcprouter["socks_service"] = false + if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then + mArray.openmptcprouter["socks_service"] = true + end + + -- Add DHCP infos by parsing dnsmasq config file + mArray.openmptcprouter.dhcpd = {} + dnsmasq = ut.trim(sys.exec("cat /var/etc/dnsmasq.conf*")) + for itf, range_start, range_end, mask, leasetime in dnsmasq:gmatch("range=[%w,!:-]*set:(%w+),(%d+\.%d+\.%d+\.%d+),(%d+\.%d+\.%d+\.%d+),(%d+\.%d+\.%d+\.%d+),(%w+)") do + mArray.openmptcprouter.dhcpd[itf] = {} + mArray.openmptcprouter.dhcpd[itf].interface = itf + mArray.openmptcprouter.dhcpd[itf].range_start = range_start + mArray.openmptcprouter.dhcpd[itf].range_end = range_end + mArray.openmptcprouter.dhcpd[itf].netmask = mask + mArray.openmptcprouter.dhcpd[itf].leasetime = leasetime + mArray.openmptcprouter.dhcpd[itf].router = mArray.openmptcprouter["local_addr"] + mArray.openmptcprouter.dhcpd[itf].dns = mArray.openmptcprouter["local_addr"] + end + for itf, option, value in dnsmasq:gmatch("option=(%w+),([%w:-]+),(%d+\.%d+\.%d+\.%d+)") do + if mArray.openmptcprouter.dhcpd[itf] then + if option == "option:router" or option == "6" then + mArray.openmptcprouter.dhcpd[itf].router = value + end + if option == "option:dns-server" or option == "" then + mArray.openmptcprouter.dhcpd[itf].dns = value + end + end + end + -- Parse mptcp kernel info + local mptcp = {} + local fullmesh = ut.trim(sys.exec("cat /proc/net/mptcp_fullmesh")) + for ind, addressId, backup, ipaddr in fullmesh:gmatch("(%d+), (%d+), (%d+), (%d+\.%d+\.%d+\.%d+)") do + mptcp[ipaddr] = {} + mptcp[ipaddr].index = ind + mptcp[ipaddr].id = addressId + mptcp[ipaddr].backup= backup + mptcp[ipaddr].ipaddr= ipaddr + end + + -- retrieve core temperature + --mArray.openmptcprouter["core_temp"] = sys.exec("cat /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input 2>/dev/null"):match("%d+") + mArray.openmptcprouter["loadavg"] = sys.exec("cat /proc/loadavg 2>/dev/null"):match("[%d%.]+ [%d%.]+ [%d%.]+") + mArray.openmptcprouter["uptime"] = sys.exec("cat /proc/uptime 2>/dev/null"):match("[%d%.]+") + + -- overview status + mArray.wans = {} + mArray.tunnels = {} + + uci:foreach("network", "interface", function (section) + local interface = section[".name"] + local net = ntm:get_network(interface) + local ipaddr = net:ipaddr() + local gateway = section['gateway'] + local multipath = section['multipath'] + + --if not ipaddr or not gateway then return end + -- Don't show if0 in the overview + --if interface == "lo" then return end + + local ifname = section['ifname'] + if multipath == "off" and not ifname:match("^tun.*") then return end + + local asn + + local connectivity + local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated")) + if multipath_state == "" then + connectivity = 'OK' + else + connectivity = 'ERROR' + end + + local publicIP = "-" + + local latency = "-" + + local data = { + label = section['label'] or interface, + name = interface, + link = net:adminlink(), + ifname = ifname, + ipaddr = ipaddr, + gateway = gateway, + multipath = section['multipath'], + status = connectivity, + wanip = publicIP, + latency = latency, + whois = asn and asn.as_description or "unknown", + qos = section['trafficcontrol'], + download = section['download'], + upload = section['upload'], + } + + if ifname:match("^tun.*") then + table.insert(mArray.tunnels, data); + else + table.insert(mArray.wans, data); + end + end) + + luci.http.prepare_content("application/json") + luci.http.write_json(mArray) end \ No newline at end of file diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm new file mode 100644 index 000000000..a71b6c242 --- /dev/null +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm @@ -0,0 +1,284 @@ +<% +-- Copyright 2015 OVH (OverTheBox@ovh.net) +-- Simon Lelievre (simon.lelievre@corp.ovh.com) +-- Sebastien Duponcheel (sebastien.duponcheel@ovh.net) +-- +-- This file is part of OverTheBox for OpenWrt. +-- +-- OverTheBox is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- OverTheBox is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with OverTheBox. If not, see (http://www.gnu.org/licenses/) +-%> +<% +-- Copyright 2018 Ycarus (Yannick Chabanois) ycarus@zugaina.org +-- +-- Small changes to make this work with OpenMPTCProuter +-%> +<%+header%> + + + + + +

<%:Network overview%>

+
+ +
+
+<%+footer%> \ No newline at end of file