1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Add MLVPN support to the wizard

This commit is contained in:
Ycarus 2018-06-07 16:51:37 +02:00
parent ab05228cf3
commit 8d5452c810
2 changed files with 49 additions and 3 deletions

View file

@ -58,10 +58,16 @@ function wizard_add()
local server_ip = luci.http.formvalue("server_ip")
-- We have an IP, so set it everywhere
if server_ip ~= "" then
ucic:set("shadowsocks-libev","sss0","server",server_ip)
ucic:set("glorytun","vpn","host",server_ip)
ucic:set("mlvpn","general","host",server_ip)
end
-- Set ShadowSocks settings
local shadowsocks_key = luci.http.formvalue("shadowsocks_key")
if shadowsocks_key ~= "" then
ucic:set("shadowsocks-libev","sss0","server",server_ip)
ucic:set("shadowsocks-libev","sss0","key",shadowsocks_key)
ucic:set("shadowsocks-libev","sss0","method","aes-256-cfb")
ucic:set("shadowsocks-libev","sss0","server_port","65101")
@ -73,7 +79,6 @@ function wizard_add()
-- Set Glorytun TCP settings
local glorytun_key = luci.http.formvalue("glorytun_key")
if glorytun_key ~= "" then
ucic:set("glorytun","vpn","host",server_ip)
ucic:set("glorytun","vpn","port","65001")
ucic:set("glorytun","vpn","key",glorytun_key)
ucic:set("glorytun","vpn","enable",1)
@ -84,6 +89,21 @@ function wizard_add()
ucic:commit("glorytun")
end
-- Set MLVPN settings
local mlvpn_password = luci.http.formvalue("mlvpn_password")
if mlvpn_password ~= "" then
if glorytun_key ~= "" then
ucic:set("mlvpn","general","enable",1)
else
ucic:set("mlvpn","general","enable",0)
end
ucic:set("mlvpn","general","password",mlvpn_password)
ucic:set("mlvpn","general","firstport","65201")
ucic:set("mlvpn","general","interface_name","mlvpn0")
ucic:save("mlvpn")
ucic:commit("mlvpn")
end
-- Set interfaces settings
local interfaces = luci.http.formvaluetable("intf")
for intf, _ in pairs(interfaces) do
@ -98,7 +118,7 @@ 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")
if gostatus then
if gostatus == true then
luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/status"))
else
luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/wizard"))

View file

@ -18,18 +18,44 @@
<label class="cbi-value-title"><%:Server IP%></label>
<div class="cbi-value-field">
<input type="text" name="server_ip" placeholder="Server IP" class="cbi-input-text" value="<%=uci:get("shadowsocks-libev","sss0","server")%>" data-type="ip4addr">
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="help" /></span>
<%:Server IP will be set for ShadowSocks, Glorytun and MLVPN%>
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:ShadowSocks key%></label>
<div class="cbi-value-field">
<input type="text" name="shadowsocks_key" placeholder="ShadowSocks key" class="cbi-input-text" value="<%=uci:get("shadowsocks-libev","sss0","key")%>" data-type="base64">
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="help" /></span>
<%:ShadowSocks is used for TCP%>
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Glorytun key%></label>
<div class="cbi-value-field">
<input type="text" name="glorytun_key" placeholder="Glorytun key" class="cbi-input-text" value="<%=uci:get("glorytun","vpn","key")%>">
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="help" /></span>
<%:Glorytun is used for UDP and ICMP%>
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:MLVPN password%></label>
<div class="cbi-value-field">
<input type="text" name="mlvpn_password" placeholder="MLVPN password" class="cbi-input-text" value="<%=uci:get("mlvpn","general","password")%>">
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="help" /></span>
<%:MLVPN can replace Glorytun with connection with same latency%>
</div>
</div>
</div>
</fieldset>