2018-03-23 19:23:27 +00:00
< %+header%>
< %
local uci = require("luci.model.uci").cursor()
local net = require "luci.model.network".init()
local ifaces = net:get_interfaces()
2018-06-26 16:07:36 +00:00
local servers_ip = {}
local server_ip = uci:get("shadowsocks-libev","sss0","server")
if server_ip == '127.0.0.1' then
local upstreams = uci:get("nginx-ha","ShadowSocks","upstreams")
for _, up in pairs(upstreams) do
local a = up:match("^([^:]+):")
table.insert(servers_ip,a)
end
else
table.insert(servers_ip,server_ip)
end
2018-03-23 19:23:27 +00:00
%>
2018-06-26 16:07:36 +00:00
< script type = "text/javascript" src = "<%=resource%>/cbi.js" data-strings = "{"path":{"resource":"\/luci-static\/resources","browser":"\/cgi-bin\/luci\/admin\/filebrowser"}}" > < / script >
2018-03-23 19:23:27 +00:00
< % if stderr and #stderr > 0 then %>< pre class = "error" > < %=pcdata(stderr)%>< / pre > < % end %>
2018-06-13 08:47:48 +00:00
< form class = "inline" method = "post" action = "<%=url('admin/system/openmptcprouter/wizard_add')%>" enctype = "multipart/form-data" >
2018-03-30 09:12:43 +00:00
< div class = "cbi-map" >
< h2 name = "content" > < %:Wizard%>< / h2 >
2018-03-30 13:47:27 +00:00
< fieldset class = "cbi-section" id = "server" >
< legend > < %:Server settings%>< / legend >
< div class = "cbi-section-descr" > < %:Put the values given by OpenMPTCProuter VPS script.%>< / div >
2018-06-26 16:07:36 +00:00
< div class = "cbi-value cbi-value-last" id = "server_ip" data-depends = "[]" data-index = "0" >
< label class = "cbi-value-title" for = "server_ip" > < %:Server IP%>< / label >
2018-03-30 09:12:43 +00:00
< div class = "cbi-value-field" >
2018-06-26 16:07:36 +00:00
< div data-prefix = "server_ip" data-browser-path = "" data-dynlist = "[[],[],null,false]" data-placeholder = "123.123.123.123" >
< %
local k = 0
for _,server in ipairs(servers_ip) do
k = k+1
%>
< input name = "server_ip" id = "server_ip.<%=k%>" placeholder = "Server IP" class = "cbi-input-text" value = "<%=server%>" data-type = "ip4addr" >
2018-06-07 14:51:37 +00:00
< br / >
2018-06-26 16:07:36 +00:00
< %
end
%>
< / div >
< 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, OpenVPN and MLVPN%>
2018-03-23 19:23:27 +00:00
< / div >
< / div >
2018-06-26 16:07:36 +00:00
< br / >
2018-03-23 19:23:27 +00:00
< 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">
2018-06-07 14:51:37 +00:00
< 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 >
2018-03-23 19:23:27 +00:00
< / div >
< / div >
2018-06-12 17:22:55 +00:00
< % if nixio.fs.access("/usr/sbin/glorytun") or nixio.fs.access("/usr/sbin/glorytun-udp") then %>
2018-03-23 19:23:27 +00:00
< 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 " ) % > ">
2018-06-07 14:51:37 +00:00
< br / >
< div class = "cbi-value-description" >
< span class = "cbi-value-helpicon" > < img src = "/luci-static/resources/cbi/help.gif" alt = "help" / > < / span >
2018-06-11 08:21:48 +00:00
< %:Glorytun TCP is used by default for UDP and ICMP%>
2018-06-07 14:51:37 +00:00
< / div >
< / div >
< / div >
2018-06-12 17:22:55 +00:00
< % end %>
< % if nixio.fs.access("/usr/sbin/mlvpn") then %>
2018-06-07 14:51:37 +00:00
< 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 >
2018-06-11 08:21:48 +00:00
< %:MLVPN can replace Glorytun with connections with same latency%>
< / div >
< / div >
< / div >
2018-06-12 17:22:55 +00:00
< % end %>
< % if nixio.fs.access("/usr/sbin/openvpn") then %>
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:OpenVPN key%>< / label >
< div class = "cbi-value-field" >
< input type = "file" name = "openvpn_key" class = "cbi-input-file" >
< input type = "text" class = "cbi-input-text" data-update = "change" value = "<%=uci:get(" openvpn " , " omr " , " secret " ) % > " />
< br / >
< div class = "cbi-value-description" >
< span class = "cbi-value-helpicon" > < img src = "/luci-static/resources/cbi/help.gif" alt = "help" / > < / span >
< %:You need to upload OpenVPN key file generated by OpenMPTCProuter VPS script to use OpenVPN TCP%>
< / div >
< / div >
< / div >
< % end %>
2018-06-11 08:21:48 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:Default VPN%>< / label >
< div class = "cbi-value-field" >
< select class = "cbi-input-select" name = "default_vpn" size = "1" >
2018-06-12 17:22:55 +00:00
< % 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/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 %>
2018-06-11 08:21:48 +00:00
< / select >
< br / >
< div class = "cbi-value-description" >
< span class = "cbi-value-helpicon" > < img src = "/luci-static/resources/cbi/help.gif" alt = "help" / > < / span >
< %:Set the default VPN used for UDP and ICMP when ShadowSocks is enabled, for all traffic if ShadowSocks is disabled.%>
2018-06-07 14:51:37 +00:00
< / div >
2018-03-23 19:23:27 +00:00
< / div >
< / div >
2018-03-30 13:47:27 +00:00
< / fieldset >
< fieldset class = "cbi-section" id = "interfaces" >
< legend > < %:Interfaces settings%>< / legend >
< div class = "cbi-section-descr" > < %:You must disable DHCP on your modems and set IP in different networks.%>< / div >
2018-03-23 19:23:27 +00:00
< %
for _, iface in ipairs(ifaces) do
--if not (iface == "lo" or iface:match("^tun.*")) then
local ifname = iface:name()
if (ifname:match("^wan.*")) then
%>
2018-04-20 12:56:19 +00:00
< div class = "cbi-section-remove right" >
< input type = "submit" name = "delete.<%=ifname%>" value = "<%:Delete%>" class = "cbi-button" / >
< / div >
2018-03-30 09:12:43 +00:00
< h3 > < %=ifname%>< / h3 >
2018-04-20 12:56:19 +00:00
< fieldset class = "cbi-section-node" id = "cbi-openmptcprouter-<%=ifname%>" >
< input type = "hidden" name = "intf.<%=ifname%>" value = "<%=ifname%>" / >
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:IPv4 address%>< / label >
< div class = "cbi-value-field" >
< input type = "text" name = "cbid.network.<%=ifname%>.ipaddr" class = "cbi-input-text" value = "<%=uci:get(" network " , ifname , " ipaddr " ) % > " 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 >
< %:Set an IP in the same network as the modem%>
< / div >
2018-04-04 16:08:10 +00:00
< / div >
2018-03-30 09:12:43 +00:00
< / div >
2018-04-20 12:56:19 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:IPv4 netmask%>< / label >
< div class = "cbi-value-field" >
< input type = "text" name = "cbid.network.<%=ifname%>.netmask" class = "cbi-input-text" value = "<%=uci:get(" network " , ifname , " netmask " ) or " 255 . 255 . 255 . 0 " % > " data-type="ip4addr">
< / div >
2018-03-30 09:12:43 +00:00
< / div >
2018-04-20 12:56:19 +00:00
< div class = "cbi-value" >
< label class = "cbi-value-title" > < %:IPv4 gateway%>< / label >
< div class = "cbi-value-field" >
< input type = "text" name = "cbid.network.<%=ifname%>.gateway" class = "cbi-input-text" value = "<%=uci:get(" network " , ifname , " gateway " ) % > " 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 >
< %:Set here IP of the modem%>
< / div >
2018-04-04 16:08:10 +00:00
< / div >
2018-03-30 09:12:43 +00:00
< / div >
2018-04-20 12:56:19 +00:00
< / fieldset >
2018-03-23 19:23:27 +00:00
< %
end
end
%>
2018-04-20 12:56:19 +00:00
< div class = "cbi-section-create" >
< input class = "cbi-button cbi-button-add" type = "submit" name = "add_interface" value = "<%:Add an interface%>" title = "<%:Add an interface%>" / >
< / div >
2018-03-30 13:47:27 +00:00
< / fieldset >
2018-03-23 19:23:27 +00:00
< / div >
< div class = "cbi-page-actions" >
< input type = "hidden" name = "token" value = "<%=token%>" / >
< button class = "btn" type = "submit" > Submit< / button >
< / div >
< / form >
2018-06-26 16:07:36 +00:00
< script type = "text/javascript" > cbi _init ( ) ; < / script >
2018-03-23 19:23:27 +00:00
< %+footer%>