mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
addfix
This commit is contained in:
parent
2bb0dca0e2
commit
8e11c19dc0
43 changed files with 2004 additions and 0 deletions
18
luci-app-ipsec-vpnd/luasrc/controller/ipsec-server.lua
Normal file
18
luci-app-ipsec-vpnd/luasrc/controller/ipsec-server.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
module("luci.controller.ipsec-server", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/ipsec") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
entry({"admin", "vpn", "ipsec-server"}, cbi("ipsec-server"), _("IPSec VPN Server"), 80).dependent = false
|
||||
entry({"admin", "vpn", "ipsec-server", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep ipsec >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
35
luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server.lua
Normal file
35
luci-app-ipsec-vpnd/luasrc/model/cbi/ipsec-server.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
mp = Map("ipsec")
|
||||
mp.title = translate("IPSec VPN Server")
|
||||
mp.description = translate("IPSec VPN connectivity using the native built-in VPN Client on iOS or Andriod (IKEv1 with PSK and Xauth)")
|
||||
|
||||
mp:section(SimpleSection).template = "ipsec/ipsec_status"
|
||||
|
||||
s = mp:section(NamedSection, "ipsec", "service")
|
||||
s.anonymouse = true
|
||||
|
||||
enabled = s:option(Flag, "enabled", translate("Enable"))
|
||||
enabled.default = 0
|
||||
enabled.rmempty = false
|
||||
|
||||
clientip = s:option(Value, "clientip", translate("VPN Client IP"))
|
||||
clientip.description = translate("LAN DHCP reserved started IP addresses with the same subnet mask")
|
||||
clientip.datatype = "ip4addr"
|
||||
clientip.optional = false
|
||||
clientip.rmempty = false
|
||||
|
||||
clientdns = s:option(Value, "clientdns", translate("VPN Client DNS"))
|
||||
clientdns.description = translate("DNS using in VPN tunnel.Set to the router's LAN IP is recommended")
|
||||
clientdns.datatype = "ip4addr"
|
||||
clientdns.optional = false
|
||||
clientdns.rmempty = false
|
||||
|
||||
account = s:option(Value, "account", translate("Account"))
|
||||
account.datatype = "string"
|
||||
|
||||
password = s:option(Value, "password", translate("Password"))
|
||||
password.password = true
|
||||
|
||||
secret = s:option(Value, "secret", translate("Secret Pre-Shared Key"))
|
||||
secret.password = true
|
||||
|
||||
return mp
|
22
luci-app-ipsec-vpnd/luasrc/view/ipsec/ipsec_status.htm
Normal file
22
luci-app-ipsec-vpnd/luasrc/view/ipsec/ipsec_status.htm
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[ipsec-server]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('ipsec_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>IPSec VPN <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>IPSec VPN <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="ipsec_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
Loading…
Add table
Add a link
Reference in a new issue