mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add A Dead Simple VPN
This commit is contained in:
parent
cfe790f601
commit
bf39d8706e
10 changed files with 668 additions and 384 deletions
|
@ -278,6 +278,10 @@ function wizard_add()
|
|||
vpn_port = 65201
|
||||
vpn_intf = "mlvpn0"
|
||||
ucic:set("network","omrvpn","proto","dhcp")
|
||||
elseif default_vpn == "dsvpn" then
|
||||
vpn_port = 65011
|
||||
vpn_intf = "tun0"
|
||||
ucic:set("network","omrvpn","proto","none")
|
||||
elseif default_vpn == "openvpn" then
|
||||
vpn_port = 65301
|
||||
vpn_intf = "tun0"
|
||||
|
@ -363,6 +367,7 @@ function wizard_add()
|
|||
end
|
||||
ucic:set("shadowsocks-libev","sss0","server",server_ip)
|
||||
ucic:set("glorytun","vpn","host",server_ip)
|
||||
ucic:set("dsvpn","vpn","host",server_ip)
|
||||
ucic:set("mlvpn","general","host",server_ip)
|
||||
luci.sys.call("uci -q del openvpn.omr.remote")
|
||||
luci.sys.call("uci -q add_list openvpn.omr.remote=" .. server_ip)
|
||||
|
@ -379,6 +384,8 @@ function wizard_add()
|
|||
ucic:commit("openvpn")
|
||||
ucic:save("mlvpn")
|
||||
ucic:commit("mlvpn")
|
||||
ucic:save("dsvpn")
|
||||
ucic:commit("dsvpn")
|
||||
ucic:save("glorytun")
|
||||
ucic:commit("glorytun")
|
||||
ucic:save("shadowsocks-libev")
|
||||
|
@ -438,6 +445,29 @@ function wizard_add()
|
|||
ucic:save("glorytun")
|
||||
ucic:commit("glorytun")
|
||||
|
||||
-- Set A Dead Simple VPN settings
|
||||
if default_vpn == "dsvpn" then
|
||||
ucic:set("dsvpn","vpn","enable",1)
|
||||
else
|
||||
ucic:set("dsvpn","vpn","enable",0)
|
||||
end
|
||||
|
||||
local dsvpn_key = luci.http.formvalue("dsvpn_key")
|
||||
if dsvpn_key ~= "" then
|
||||
ucic:set("dsvpn","vpn","port","65011")
|
||||
ucic:set("dsvpn","vpn","key",dsvpn_key)
|
||||
ucic:set("glorytun","vpn","localip","10.255.251.2")
|
||||
ucic:set("glorytun","vpn","remoteip","10.255.251.1")
|
||||
ucic:set("network","omr6in4","ipaddr","10.255.251.2")
|
||||
ucic:set("network","omr6in4","peeraddr","10.255.251.1")
|
||||
ucic:set("network","omrvpn","proto","none")
|
||||
else
|
||||
ucic:set("dsvpn","vpn","key","")
|
||||
ucic:set("dsvpn","vpn","enable",0)
|
||||
end
|
||||
ucic:save("dsvpn")
|
||||
ucic:commit("dsvpn")
|
||||
|
||||
-- Set MLVPN settings
|
||||
if default_vpn == "mlvpn" then
|
||||
ucic:set("mlvpn","general","enable",1)
|
||||
|
@ -509,6 +539,7 @@ function wizard_add()
|
|||
os.execute("sleep 2")
|
||||
end
|
||||
luci.sys.call("/etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/dsvpn restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/glorytun restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/glorytun-udp restart >/dev/null 2>/dev/null")
|
||||
--luci.sys.call("/etc/init.d/mlvpn restart >/dev/null 2>/dev/null")
|
||||
|
@ -879,7 +910,7 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["tun_service"] = false
|
||||
mArray.openmptcprouter["tun_state"] = ""
|
||||
mArray.openmptcprouter["tun6_state"] = ""
|
||||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
||||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%d+") then
|
||||
mArray.openmptcprouter["tun_service"] = true
|
||||
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
||||
local tun_dev = uci:get("network","omrvpn","ifname")
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
}
|
||||
if (mArray.openmptcprouter.tun_service == false)
|
||||
{
|
||||
statusMessage += _('GloryTUN is not running') + '<br/>';
|
||||
statusMessage += _('VPN is not running') + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.dns == false)
|
||||
{
|
||||
|
|
|
@ -164,6 +164,18 @@ end
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/dsvpn") then %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:A Dead Simple VPN key%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="dsvpn_key" placeholder="A Dead Simple VPN key" class="cbi-input-text" value="<%=uci:get("dsvpn","vpn","key")%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:A Dead Simple VPN is a TCP VPN that can replace Glorytun TCP%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/mlvpn") then %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:MLVPN password%></label>
|
||||
|
@ -205,6 +217,8 @@ end
|
|||
<% if nixio.fs.access("/usr/sbin/glorytun") then %><option value="glorytun_tcp" <% if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "tcp" then %>selected="selected"<% end %>>Glorytun TCP</option><% end %>
|
||||
<% elseif vpn == "glorytun-udp" then %>
|
||||
<% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><option value="glorytun_udp" <% if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "udp" then %>selected="selected"<% end %>>Glorytun UDP</option><% end %>
|
||||
<% elseif vpn == "dsvpn" then %>
|
||||
<% if nixio.fs.access("/usr/sbin/dsvpn") then %><option value="dsvpn" <% if uci:get("dsvpn","vpn","enable") == "1" then %>selected="selected"<% end %>>A Dead Simple VPN</option><% end %>
|
||||
<% elseif vpn == "mlvpn" then %>
|
||||
<% if nixio.fs.access("/usr/sbin/mlvpn") then %><option value="mlvpn" <% if uci:get("mlvpn","general","enable") == "1" then %>selected="selected"<% end %>>MLVPN</option><% end %>
|
||||
<% elseif vpn == "openvpn" then %>
|
||||
|
@ -219,6 +233,7 @@ end
|
|||
%>
|
||||
<% if nixio.fs.access("/usr/sbin/glorytun") then %><option value="glorytun_tcp" <% if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "tcp" then %>selected="selected"<% end %>>Glorytun TCP</option><% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><option value="glorytun_udp" <% if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "udp" then %>selected="selected"<% end %>>Glorytun UDP</option><% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/dsvpn") then %><option value="dsvpn" <% if uci:get("dsvpn","vpn","enable") == "1" then %>selected="selected"<% end %>>A Dead Simple VPN</option><% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/mlvpn") then %><option value="mlvpn" <% if uci:get("mlvpn","general","enable") == "1" then %>selected="selected"<% end %>>MLVPN</option><% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/openvpn") then %><option value="openvpn" <% if uci:get("openvpn","omr","enabled") == "1" then %>selected="selected"<% end %>>OpenVPN</option><% end %>
|
||||
<option value="none" <% if uci:get("openmptcprouter","settings","vpn") == "none" then %>selected="selected"<% end %>>None</option>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue