summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-multiwan/luasrc
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-multiwan/luasrc')
-rw-r--r--applications/luci-multiwan/luasrc/controller/multiwan.lua60
-rw-r--r--applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua155
-rw-r--r--applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua67
-rw-r--r--applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm1
-rw-r--r--applications/luci-multiwan/luasrc/view/multiwan_status.htm71
5 files changed, 0 insertions, 354 deletions
diff --git a/applications/luci-multiwan/luasrc/controller/multiwan.lua b/applications/luci-multiwan/luasrc/controller/multiwan.lua
deleted file mode 100644
index b596ef7e3..000000000
--- a/applications/luci-multiwan/luasrc/controller/multiwan.lua
+++ /dev/null
@@ -1,60 +0,0 @@
-module("luci.controller.multiwan", package.seeall)
-
-function index()
- local fs = luci.fs or nixio.fs
- if not fs.access("/etc/config/multiwan") then
- return
- end
-
- local page
-
- page = entry({"admin", "network", "multiwan"}, cbi("multiwan/multiwan"), _("Multi-WAN"))
- page.dependent = true
-
- entry({"admin", "network", "multiwan", "status"}, call("multiwan_status"))
-
- page = entry({"mini", "network", "multiwan"}, cbi("multiwan/multiwanmini", {autoapply=true}), _("Multi-WAN"))
- page.dependent = true
-end
-function multiwan_status()
- local nfs = require "nixio.fs"
- local cachefile = "/tmp/.mwan/cache"
-
- local rv = { }
-
- cachefile = nfs.readfile(cachefile)
- if cachefile then
- local ntm = require "luci.model.network".init()
- _, _, wan_if_map = string.find(cachefile, "wan_if_map=\"([^\"]*)\"")
- _, _, wan_fail_map = string.find(cachefile, "wan_fail_map=\"([^\"]*)\"")
- _, _, wan_recovery_map = string.find(cachefile, "wan_recovery_map=\"([^\"]*)\"")
-
- rv.wans = { }
- wansid = {}
-
- for wanname, wanifname in string.gfind(wan_if_map, "([^%[]+)%[([^%]]+)%]") do
- local wanlink = ntm:get_interface(wanifname)
- wanlink = wanlink and wanlink:get_network()
- wanlink = wanlink and wanlink:adminlink() or "#"
- wansid[wanname] = #rv.wans + 1
- rv.wans[wansid[wanname]] = { name = wanname, link = wanlink, ifname = wanifname, status = "ok", count = 0 }
- end
-
- for wanname, failcount in string.gfind(wan_fail_map, "([^%[]+)%[([^%]]+)%]") do
- if failcount == "x" then
- rv.wans[wansid[wanname]].status = "ko"
- else
- rv.wans[wansid[wanname]].status = "failing"
- rv.wans[wansid[wanname]].count = failcount
- end
- end
-
- for wanname, recoverycount in string.gfind(wan_recovery_map, "([^%[]+)%[([^%]]+)%]") do
- rv.wans[wansid[wanname]].status = "recovering"
- rv.wans[wansid[wanname]].count = recoverycount
- end
- end
-
- luci.http.prepare_content("application/json")
- luci.http.write_json(rv)
-end
diff --git a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua b/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua
deleted file mode 100644
index 586b6307d..000000000
--- a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwan.lua
+++ /dev/null
@@ -1,155 +0,0 @@
-require("luci.tools.webadmin")
-
-m = Map("multiwan", translate("Multi-WAN"),
- translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover."))
-
-s = m:section(NamedSection, "config", "multiwan", "")
-
-e = s:option(Flag, "enabled", translate("Enable"))
-e.rmempty = false
-e.default = e.enabled
-
-function e.write(self, section, value)
- if value == "0" then
- os.execute("/etc/init.d/multiwan stop")
- else
- os.execute("/etc/init.d/multiwan enable")
- end
- Flag.write(self, section, value)
-end
-
-s = m:section(TypedSection, "interface", translate("WAN Interfaces"),
- translate("Health Monitor detects and corrects network changes and failed connections."))
-s.addremove = true
-
-weight = s:option(ListValue, "weight", translate("Load Balancer Distribution"))
-weight:value("10", "10")
-weight:value("9", "9")
-weight:value("8", "8")
-weight:value("7", "7")
-weight:value("6", "6")
-weight:value("5", "5")
-weight:value("4", "4")
-weight:value("3", "3")
-weight:value("2", "2")
-weight:value("1", "1")
-weight:value("disable", translate("None"))
-weight.default = "10"
-weight.optional = false
-weight.rmempty = false
-
-interval = s:option(ListValue, "health_interval", translate("Health Monitor Interval"))
-interval:value("disable", translate("Disable"))
-interval:value("5", "5 sec.")
-interval:value("10", "10 sec.")
-interval:value("20", "20 sec.")
-interval:value("30", "30 sec.")
-interval:value("60", "60 sec.")
-interval:value("120", "120 sec.")
-interval.default = "10"
-interval.optional = false
-interval.rmempty = false
-
-icmp_hosts = s:option(Value, "icmp_hosts", translate("Health Monitor ICMP Host(s)"))
-icmp_hosts:value("disable", translate("Disable"))
-icmp_hosts:value("dns", "DNS Server(s)")
-icmp_hosts:value("gateway", "WAN Gateway")
-icmp_hosts.default = "dns"
-icmp_hosts.optional = false
-icmp_hosts.rmempty = false
-
-timeout = s:option(ListValue, "timeout", translate("Health Monitor ICMP Timeout"))
-timeout:value("1", "1 sec.")
-timeout:value("2", "2 sec.")
-timeout:value("3", "3 sec.")
-timeout:value("4", "4 sec.")
-timeout:value("5", "5 sec.")
-timeout:value("10", "10 sec.")
-timeout.default = "3"
-timeout.optional = false
-timeout.rmempty = false
-
-fail = s:option(ListValue, "health_fail_retries", translate("Attempts Before WAN Failover"))
-fail:value("1", "1")
-fail:value("3", "3")
-fail:value("5", "5")
-fail:value("10", "10")
-fail:value("15", "15")
-fail:value("20", "20")
-fail.default = "3"
-fail.optional = false
-fail.rmempty = false
-
-recovery = s:option(ListValue, "health_recovery_retries", translate("Attempts Before WAN Recovery"))
-recovery:value("1", "1")
-recovery:value("3", "3")
-recovery:value("5", "5")
-recovery:value("10", "10")
-recovery:value("15", "15")
-recovery:value("20", "20")
-recovery.default = "5"
-recovery.optional = false
-recovery.rmempty = false
-
-failover_to = s:option(ListValue, "failover_to", translate("Failover Traffic Destination"))
-failover_to:value("disable", translate("None"))
-luci.tools.webadmin.cbi_add_networks(failover_to)
-failover_to:value("fastbalancer", translate("Load Balancer(Performance)"))
-failover_to:value("balancer", translate("Load Balancer(Compatibility)"))
-failover_to.default = "balancer"
-failover_to.optional = false
-failover_to.rmempty = false
-
-dns = s:option(Value, "dns", translate("DNS Server(s)"))
-dns:value("auto", translate("Auto"))
-dns.default = "auto"
-dns.optional = false
-dns.rmempty = true
-
-s = m:section(TypedSection, "mwanfw", translate("Multi-WAN Traffic Rules"),
- translate("Configure rules for directing outbound traffic through specified WAN Uplinks."))
-s.template = "cbi/tblsection"
-s.anonymous = true
-s.addremove = true
-
-src = s:option(Value, "src", translate("Source Address"))
-src.rmempty = true
-src:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(src)
-
-dst = s:option(Value, "dst", translate("Destination Address"))
-dst.rmempty = true
-dst:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(dst)
-
-proto = s:option(Value, "proto", translate("Protocol"))
-proto:value("", translate("all"))
-proto:value("tcp", "TCP")
-proto:value("udp", "UDP")
-proto:value("icmp", "ICMP")
-proto.rmempty = true
-
-ports = s:option(Value, "ports", translate("Ports"))
-ports.rmempty = true
-ports:value("", translate("all", translate("all")))
-
-wanrule = s:option(ListValue, "wanrule", translate("WAN Uplink"))
-luci.tools.webadmin.cbi_add_networks(wanrule)
-wanrule:value("fastbalancer", translate("Load Balancer(Performance)"))
-wanrule:value("balancer", translate("Load Balancer(Compatibility)"))
-wanrule.default = "fastbalancer"
-wanrule.optional = false
-wanrule.rmempty = false
-
-s = m:section(NamedSection, "config", "", "")
-s.addremove = false
-
-default_route = s:option(ListValue, "default_route", translate("Default Route"))
-luci.tools.webadmin.cbi_add_networks(default_route)
-default_route:value("fastbalancer", translate("Load Balancer(Performance)"))
-default_route:value("balancer", translate("Load Balancer(Compatibility)"))
-default_route.default = "balancer"
-default_route.optional = false
-default_route.rmempty = false
-
-return m
diff --git a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua b/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua
deleted file mode 100644
index d38974549..000000000
--- a/applications/luci-multiwan/luasrc/model/cbi/multiwan/multiwanmini.lua
+++ /dev/null
@@ -1,67 +0,0 @@
-require("luci.tools.webadmin")
-
-m = Map("multiwan", translate("Multi-WAN"),
- translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover."))
-
-s = m:section(NamedSection, "config", "multiwan", "")
-
-e = s:option(Flag, "enabled", translate("Enable"))
-e.rmempty = false
-e.default = "1"
-
-function e.write(self, section, value)
- if value == "0" then
- os.execute("/etc/init.d/multiwan stop")
- else
- os.execute("/etc/init.d/multiwan enable")
- end
- Flag.write(self, section, value)
-end
-
-s = m:section(TypedSection, "mwanfw", translate("Multi-WAN Traffic Rules"),
- translate("Configure rules for directing outbound traffic through specified WAN Uplinks."))
-s.template = "cbi/tblsection"
-s.anonymous = true
-s.addremove = true
-
-src = s:option(Value, "src", translate("Source Address"))
-src.rmempty = true
-src:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(src)
-
-dst = s:option(Value, "dst", translate("Destination Address"))
-dst.rmempty = true
-dst:value("", translate("all"))
-luci.tools.webadmin.cbi_add_knownips(dst)
-
-proto = s:option(Value, "proto", translate("Protocol"))
-proto:value("", translate("all"))
-proto:value("tcp", "TCP")
-proto:value("udp", "UDP")
-proto:value("icmp", "ICMP")
-proto.rmempty = true
-
-ports = s:option(Value, "ports", translate("Ports"))
-ports.rmempty = true
-ports:value("", translate("all", translate("all")))
-
-wanrule = s:option(ListValue, "wanrule", translate("WAN Uplink"))
-luci.tools.webadmin.cbi_add_networks(wanrule)
-wanrule:value("fastbalancer", translate("Load Balancer(Performance)"))
-wanrule:value("balancer", translate("Load Balancer(Compatibility)"))
-wanrule.default = "fastbalancer"
-wanrule.optional = false
-wanrule.rmempty = false
-
-s = m:section(NamedSection, "config", "", "")
-s.addremove = false
-
-default_route = s:option(ListValue, "default_route", translate("Default Route"))
-luci.tools.webadmin.cbi_add_networks(default_route)
-default_route:value("fastbalancer", translate("Load Balancer(Performance)"))
-default_route:value("balancer", translate("Load Balancer(Compatibility)"))
-default_route.default = "balancer"
-default_route.optional = false
-default_route.rmempty = false
-
-return m
diff --git a/applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm b/applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm
deleted file mode 100644
index 79c04539f..000000000
--- a/applications/luci-multiwan/luasrc/view/admin_status/index/multiwan.htm
+++ /dev/null
@@ -1 +0,0 @@
-<%+multiwan_status%>
diff --git a/applications/luci-multiwan/luasrc/view/multiwan_status.htm b/applications/luci-multiwan/luasrc/view/multiwan_status.htm
deleted file mode 100644
index 8c4127b23..000000000
--- a/applications/luci-multiwan/luasrc/view/multiwan_status.htm
+++ /dev/null
@@ -1,71 +0,0 @@
-<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "multiwan", "status")%>', null,
- function(x, st)
- {
- var tx = document.getElementById('multiwan_status_text');
- if (tx)
- {
- if (st && st.wans)
- {
- var temp = '';
-
- for( var i = 0; i < st.wans.length; i++ )
- {
- var stat = '<%:Unknown%>';
- var cssc = '';
-
- switch (st.wans[i].status)
- {
- case 'ok':
- stat = '<%:OK%>';
- cssc = 'wanok';
- break;
-
- case 'ko':
- stat = '<%:KO%>';
- cssc = 'wanko';
- break;
-
- case 'recovering':
- stat = String.format('<%:Recovering%>(%d)', st.wans[i].count);
- cssc = 'wanrecov';
- break;
-
- case 'failing':
- stat = String.format('<%:Failing%>(%d)', st.wans[i].count);
- cssc = 'wanfail';
- break;
- }
-
- temp += String.format(
- '<span class="%s"><strong>%s (<a href="%q">%s</a>) :</strong> %s</span>',
- cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat
- );
- }
-
- tx.innerHTML = temp;
- }
- else
- {
- tx.innerHTML = '';
- }
- }
- }
- );
-//]]></script>
-
-<style type="text/css">
- .wanok { background-color: rgb(144, 240, 144); }
- .wanko { background-color: rgb(240, 144, 144); }
- .wanrecov { background-color: rgb(240, 240, 0); }
- .wanfail { background-color: rgb(255, 165, 0); }
- .wanko, .wanok, .wanrecov, .wanfail {
- padding: 0.4em;
- margin: 0.4em;
- }
-</style>
-
-<fieldset class="cbi-section">
- <legend><%:Multi-WAN Status%></legend>
- <div id="multiwan_status_text" style="text-align:center;"><em><%:Collecting data...%></em></div>
-</fieldset>