mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Merge branch 'develop'
This commit is contained in:
commit
55640786a2
201 changed files with 36233 additions and 4723 deletions
|
|
@ -194,7 +194,7 @@ right connector from last child*/
|
|||
border-left: 2px solid black;
|
||||
border-bottom: none;
|
||||
width: 2px;
|
||||
height: 30px;
|
||||
height: 20em;
|
||||
z-index: -10;
|
||||
}
|
||||
.remote-from-lease a {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,9 @@ function wizard_add()
|
|||
ucic:foreach("network", "interface", function(s)
|
||||
local sectionname = s[".name"]
|
||||
if sectionname:match("^wan(%d+)$") then
|
||||
i = i + 1
|
||||
if i <= tonumber(string.match(sectionname, '%d+')) then
|
||||
i = tonumber(string.match(sectionname, '%d+')) + 1
|
||||
end
|
||||
end
|
||||
if ucic:get("network",sectionname,"multipath") == "master" then
|
||||
multipath_master = true
|
||||
|
|
@ -213,14 +215,56 @@ function wizard_add()
|
|||
for intf, _ in pairs(interfaces) do
|
||||
local label = luci.http.formvalue("cbid.network.%s.label" % intf) or ""
|
||||
local proto = luci.http.formvalue("cbid.network.%s.proto" % intf) or "static"
|
||||
local typeintf = luci.http.formvalue("cbid.network.%s.type" % intf) or ""
|
||||
local masterintf = luci.http.formvalue("cbid.network.%s.masterintf" % intf) or ""
|
||||
local ifname = luci.http.formvalue("cbid.network.%s.intf" % intf) or ""
|
||||
local device = luci.http.formvalue("cbid.network.%s.device" % intf) or ""
|
||||
local ipaddr = luci.http.formvalue("cbid.network.%s.ipaddr" % intf) or ""
|
||||
local netmask = luci.http.formvalue("cbid.network.%s.netmask" % intf) or ""
|
||||
local gateway = luci.http.formvalue("cbid.network.%s.gateway" % intf) or ""
|
||||
local apn = luci.http.formvalue("cbid.network.%s.apn" % intf) or ""
|
||||
local pincode = luci.http.formvalue("cbid.network.%s.pincode" % intf) or ""
|
||||
local delay = luci.http.formvalue("cbid.network.%s.delay" % intf) or ""
|
||||
local username = luci.http.formvalue("cbid.network.%s.username" % intf) or ""
|
||||
local password = luci.http.formvalue("cbid.network.%s.password" % intf) or ""
|
||||
local auth = luci.http.formvalue("cbid.network.%s.auth" % intf) or ""
|
||||
local mode = luci.http.formvalue("cbid.network.%s.mode" % intf) or ""
|
||||
local sqmenabled = luci.http.formvalue("cbid.sqm.%s.enabled" % intf) or "0"
|
||||
local multipath = luci.http.formvalue("cbid.network.%s.multipath" % intf) or "on"
|
||||
local lan = luci.http.formvalue("cbid.network.%s.lan" % intf) or "0"
|
||||
if typeintf ~= "" then
|
||||
if typeintf == "normal" then
|
||||
typeintf = ""
|
||||
end
|
||||
ucic:set("network",intf,"type",typeintf)
|
||||
end
|
||||
if typeintf == "macvlan" and masterintf ~= "" then
|
||||
ucic:set("network",intf,"type","macvlan")
|
||||
ucic:set("network",intf,"masterintf",masterintf)
|
||||
elseif typeintf == "" and ifname ~= "" and (proto == "static" or proto == "dhcp" ) then
|
||||
ucic:set("network",intf,"ifname",ifname)
|
||||
elseif typeintf == "" and device ~= "" and (proto == "ncm" or proto == "qmi" or proto == "modemmanager") then
|
||||
ucic:set("network",intf,"device",device)
|
||||
end
|
||||
if proto ~= "other" then
|
||||
ucic:set("network",intf,"proto",proto)
|
||||
end
|
||||
ucic:set("network",intf,"apn",apn)
|
||||
ucic:set("network",intf,"pincode",pincode)
|
||||
ucic:set("network",intf,"delay",delay)
|
||||
ucic:set("network",intf,"username",username)
|
||||
ucic:set("network",intf,"password",password)
|
||||
ucic:set("network",intf,"auth",auth)
|
||||
ucic:set("network",intf,"mode",mode)
|
||||
ucic:set("network",intf,"label",label)
|
||||
if lan == "1" then
|
||||
ucic:set("network",intf,"multipath","off")
|
||||
else
|
||||
ucic:set("network",intf,"multipath",multipath)
|
||||
ucic:set("openmptcprouter",intf,"multipath",multipath)
|
||||
end
|
||||
ucic:set("network",intf,"defaultroute",0)
|
||||
ucic:set("network",intf,"peerdns",0)
|
||||
if ipaddr ~= "" then
|
||||
ucic:set("network",intf,"ipaddr",ipaddr)
|
||||
ucic:set("network",intf,"netmask",netmask)
|
||||
|
|
@ -395,6 +439,24 @@ function wizard_add()
|
|||
ucic:save("openmptcprouter")
|
||||
end
|
||||
|
||||
-- Get Proxy set by default
|
||||
local default_proxy = luci.http.formvalue("default_proxy") or "shadowsocks"
|
||||
if default_proxy == "shadowsocks" and serversnb > 0 then
|
||||
ucic:set("shadowsocks-libev","sss0","disabled","0")
|
||||
ucic:set("v2ray","main","enabled","0")
|
||||
elseif default_proxy == "v2ray" and serversnb > 0 then
|
||||
ucic:set("shadowsocks-libev","sss0","disabled","1")
|
||||
ucic:set("v2ray","main","enabled","1")
|
||||
else
|
||||
ucic:set("shadowsocks-libev","sss0","disabled","1")
|
||||
ucic:set("v2ray","main","enabled","0")
|
||||
end
|
||||
ucic:set("openmptcprouter","settings","proxy",default_proxy)
|
||||
ucic:save("openmptcprouter")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:save("v2ray")
|
||||
|
||||
|
||||
local ss_servers_nginx = {}
|
||||
local ss_servers_ha = {}
|
||||
local vpn_servers = {}
|
||||
|
|
@ -415,6 +477,8 @@ function wizard_add()
|
|||
ucic:set("dsvpn","vpn","host",server_ip)
|
||||
ucic:set("mlvpn","general","host",server_ip)
|
||||
ucic:set("ubond","general","host",server_ip)
|
||||
ucic:set("v2ray","omrout","s_vmess_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_vless_address",server_ip)
|
||||
luci.sys.call("uci -q del openvpn.omr.remote")
|
||||
luci.sys.call("uci -q add_list openvpn.omr.remote=" .. server_ip)
|
||||
ucic:set("qos","serverin","srchost",server_ip)
|
||||
|
|
@ -434,6 +498,8 @@ function wizard_add()
|
|||
ucic:set("dsvpn","vpn","host",server_ip)
|
||||
ucic:set("mlvpn","general","host",server_ip)
|
||||
ucic:set("ubond","general","host",server_ip)
|
||||
ucic:set("v2ray","omrout","s_vmess_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_vless_address",server_ip)
|
||||
luci.sys.call("uci -q del openvpn.omr.remote")
|
||||
luci.sys.call("uci -q add_list openvpn.omr.remote=" .. server_ip)
|
||||
ucic:set("qos","serverin","srchost",server_ip)
|
||||
|
|
@ -450,6 +516,7 @@ function wizard_add()
|
|||
--ucic:commit("openvpn")
|
||||
ucic:save("mlvpn")
|
||||
ucic:save("ubond")
|
||||
ucic:save("v2ray")
|
||||
--ucic:commit("mlvpn")
|
||||
ucic:save("dsvpn")
|
||||
--ucic:commit("dsvpn")
|
||||
|
|
@ -463,41 +530,43 @@ function wizard_add()
|
|||
if encryption == "none" then
|
||||
ucic:set("shadowsocks-libev","sss0","method","none")
|
||||
ucic:set("openvpn","omr","cipher","none")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_security","none")
|
||||
ucic:set("v2ray","omrout","s_vless_user_security","none")
|
||||
elseif encryption == "aes-256-gcm" then
|
||||
ucic:set("shadowsocks-libev","sss0","method","aes-256-gcm")
|
||||
ucic:set("glorytun","vpn","chacha20","0")
|
||||
ucic:set("openvpn","omr","cipher","AES-256-GCM")
|
||||
ucic:save("openvpn")
|
||||
ucic:save("glorytun")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_security","aes-128-gcm")
|
||||
ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm")
|
||||
elseif encryption == "aes-256-cfb" then
|
||||
ucic:set("shadowsocks-libev","sss0","method","aes-256-cfb")
|
||||
ucic:set("glorytun","vpn","chacha20","0")
|
||||
ucic:set("openvpn","omr","cipher","AES-256-CFB")
|
||||
ucic:save("openvpn")
|
||||
ucic:save("glorytun")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_security","aes-128-gcm")
|
||||
ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm")
|
||||
elseif encryption == "chacha20-ietf-poly1305" then
|
||||
ucic:set("shadowsocks-libev","sss0","method","chacha20-ietf-poly1305")
|
||||
ucic:set("glorytun","vpn","chacha20","1")
|
||||
ucic:set("openvpn","omr","cipher","AES-256-CBC")
|
||||
ucic:save("openvpn")
|
||||
ucic:save("glorytun")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_security","chacha20-poly1305")
|
||||
ucic:set("v2ray","omrout","s_vless_user_security","chacha20-poly1305")
|
||||
end
|
||||
ucic:save("openvpn")
|
||||
ucic:save("glorytun")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:save("v2ray")
|
||||
|
||||
-- Set ShadowSocks settings
|
||||
local shadowsocks_key = luci.http.formvalue("shadowsocks_key")
|
||||
local shadowsocks_disable = luci.http.formvalue("disableshadowsocks") or "0"
|
||||
if disablednb == serversnb then
|
||||
shadowsocks_disable = 1
|
||||
end
|
||||
--local shadowsocks_disable = luci.http.formvalue("disableshadowsocks") or "0"
|
||||
--if disablednb == serversnb then
|
||||
-- shadowsocks_disable = 1
|
||||
--end
|
||||
if shadowsocks_key ~= "" then
|
||||
ucic:set("shadowsocks-libev","sss0","key",shadowsocks_key)
|
||||
--ucic:set("shadowsocks-libev","sss0","method","chacha20-ietf-poly1305")
|
||||
--ucic:set("shadowsocks-libev","sss0","server_port","65101")
|
||||
ucic:set("shadowsocks-libev","sss0","disabled",shadowsocks_disable)
|
||||
--ucic:set("shadowsocks-libev","sss0","disabled",shadowsocks_disable)
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
if shadowsocks_disable == "1" then
|
||||
|
|
@ -505,16 +574,19 @@ function wizard_add()
|
|||
end
|
||||
else
|
||||
if serversnb == 0 then
|
||||
shadowsocks_disable = 1
|
||||
else
|
||||
shadowsocks_disable = 0
|
||||
ucic:set("shadowsocks-libev","sss0","disabled",shadowsocks_disable)
|
||||
end
|
||||
ucic:set("shadowsocks-libev","sss0","key","")
|
||||
ucic:set("shadowsocks-libev","sss0","disabled",shadowsocks_disable)
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
luci.sys.call("/etc/init.d/shadowsocks rules_down >/dev/null 2>/dev/null")
|
||||
end
|
||||
local v2ray_user = luci.http.formvalue("v2ray_user")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_id",v2ray_user)
|
||||
ucic:set("v2ray","omrout","s_vless_user_id",v2ray_user)
|
||||
ucic:save("v2ray")
|
||||
ucic:commit("v2ray")
|
||||
|
||||
|
||||
-- Set Glorytun settings
|
||||
if default_vpn:match("^glorytun.*") and disablednb ~= serversnb then
|
||||
|
|
@ -621,6 +693,10 @@ function wizard_add()
|
|||
end
|
||||
ucic:save("openvpn")
|
||||
ucic:commit("openvpn")
|
||||
|
||||
ucic:save("v2ray")
|
||||
ucic:commit("v2ray")
|
||||
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
|
||||
|
|
@ -640,10 +716,10 @@ function wizard_add()
|
|||
luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/mptcp restart >/dev/null 2>/dev/null")
|
||||
if openmptcprouter_vps_key ~= "" then
|
||||
luci.sys.call("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("sleep 2")
|
||||
end
|
||||
--if openmptcprouter_vps_key ~= "" then
|
||||
-- luci.sys.call("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
|
||||
-- luci.sys.call("sleep 2")
|
||||
--end
|
||||
luci.sys.call("/etc/init.d/shadowsocks-libev 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")
|
||||
|
|
@ -655,6 +731,7 @@ function wizard_add()
|
|||
luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/mptcpovervpn restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/vnstat restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/v2ray restart >/dev/null 2>/dev/null")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/status"))
|
||||
else
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/wizard"))
|
||||
|
|
@ -688,10 +765,21 @@ function settings_add()
|
|||
luci.sys.exec("sysctl -w net.ipv4.tcp_syn_retries=%s" % tcp_syn_retries)
|
||||
luci.sys.exec("sed -i 's:^net.ipv4.tcp_syn_retries=[0-9]*:net.ipv4.tcp_syn_retries=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_syn_retries)
|
||||
|
||||
--local tcp_retries2 = luci.http.formvalue("tcp_retries2")
|
||||
--luci.sys.exec("sysctl -w net.ipv4.tcp_retries2=%s" % tcp_retries2)
|
||||
--luci.sys.exec("sed -i 's:^net.ipv4.tcp_retries2=[0-9]*:net.ipv4.tcp_retries2=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_retries2)
|
||||
|
||||
-- Set tcp_retries1
|
||||
local tcp_retries1 = luci.http.formvalue("tcp_retries1")
|
||||
luci.sys.exec("sysctl -w net.ipv4.tcp_retries1=%s" % tcp_retries1)
|
||||
luci.sys.exec("sed -i 's:^net.ipv4.tcp_retries1=[0-9]*:net.ipv4.tcp_retries1=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_retries1)
|
||||
|
||||
-- Set tcp_retries2
|
||||
local tcp_retries2 = luci.http.formvalue("tcp_retries2")
|
||||
luci.sys.exec("sysctl -w net.ipv4.tcp_retries2=%s" % tcp_retries2)
|
||||
luci.sys.exec("sed -i 's:^net.ipv4.tcp_retries2=[0-9]*:net.ipv4.tcp_retries2=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_retries2)
|
||||
|
||||
-- Set ip_default_ttl
|
||||
local ip_default_ttl = luci.http.formvalue("ip_default_ttl")
|
||||
luci.sys.exec("sysctl -w net.ipv4.ip_default_ttl=%s" % ip_default_ttl)
|
||||
luci.sys.exec("sed -i 's:^net.ipv4.ip_default_ttl=[0-9]*:net.ipv4.ip_default_ttl=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % ip_default_ttl)
|
||||
|
||||
-- Set tcp_fastopen
|
||||
local tcp_fastopen = luci.http.formvalue("tcp_fastopen")
|
||||
local disablefastopen = luci.http.formvalue("disablefastopen") or "0"
|
||||
|
|
@ -718,7 +806,7 @@ function settings_add()
|
|||
|
||||
-- Enable/disable vnstat backup
|
||||
local savevnstat = luci.http.formvalue("savevnstat") or "0"
|
||||
luci.sys.exec("uci -q set vnstat.@vnstat[0].backup=%s" % savevnstat)
|
||||
luci.sys.exec("uci -q set openmptcprouter.settings.vnstat_backup=%s" % savevnstat)
|
||||
ucic:commit("vnstat")
|
||||
|
||||
-- Enable/disable gateway ping
|
||||
|
|
@ -729,6 +817,10 @@ function settings_add()
|
|||
local disabledefaultgw = luci.http.formvalue("disabledefaultgw") or "1"
|
||||
ucic:set("openmptcprouter","settings","defaultgw",disabledefaultgw)
|
||||
|
||||
-- Enable/disable tracebox
|
||||
local tracebox = luci.http.formvalue("tracebox") or "1"
|
||||
ucic:set("openmptcprouter","settings","tracebox",tracebox)
|
||||
|
||||
-- Enable/disable server ping
|
||||
local disableserverping = luci.http.formvalue("disableserverping") or "0"
|
||||
ucic:set("openmptcprouter","settings","disableserverping",disableserverping)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
end
|
||||
%>
|
||||
|
||||
|
||||
<hr />
|
||||
<form class="inline" method="post" action="<%=url('admin/system/openmptcprouter/settings_add')%>">
|
||||
<div class="cbi-map">
|
||||
<h2 name="content"><%:Advanced Settings%></h2>
|
||||
|
|
@ -111,6 +111,7 @@
|
|||
end
|
||||
%>
|
||||
</fieldset>
|
||||
<hr />
|
||||
<fieldset class="cbi-section" id="networks">
|
||||
<legend><%:Networks settings%></legend>
|
||||
<div class="cbi-section-descr"></div>
|
||||
|
|
@ -118,18 +119,50 @@
|
|||
<label class="cbi-value-title"><%:IPv4 TCP Keepalive time%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="tcp_keepalive_time" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_keepalive_time")):match(" %d+"))%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:How often TCP sends out keepalive messages when keepalive is enabled.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:IPv4 TCP FIN timeout%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="tcp_fin_timeout" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_fin_timeout")):match(" %d+"))%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:The length of time an orphaned (no longer referenced by any application) connection will remain in the FIN_WAIT_2 state before it is aborted at the local end.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:IPv4 TCP SYN retries%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="tcp_syn_retries" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_syn_retries")):match(" %d+"))%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Number of times initial SYNs for an active TCP connection attempt will be retransmitted.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:IPv4 TCP SYN retries1%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="tcp_retries1" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_retries1")):match(" %d+"))%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:This value influences the time, after which TCP decides, that something is wrong due to unacknowledged RTO retransmissions, and reports this suspicion to the network layer.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:IPv4 TCP SYN retries2%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="tcp_retries2" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_retries2")):match(" %d+"))%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:This value influences the timeout of an alive TCP connection, when RTO retransmissions remain unacknowledged.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
|
|
@ -138,6 +171,12 @@
|
|||
<input type="text" name="tcp_fastopen" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.tcp_fastopen")):match(" %d+"))%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:IPv4 IP default TTL%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="ip_default_ttl" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("sysctl net.ipv4.ip_default_ttl")):match(" %d+"))%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Enable IPv6%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
|
@ -174,10 +213,15 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<hr />
|
||||
<fieldset class="cbi-section" id="other">
|
||||
<legend><%:Other settings%></legend>
|
||||
<div class="cbi-section-descr"></div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Save vnstats stats%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="savevnstat" class="cbi-input-checkbox" value="1" <% if luci.util.trim(luci.sys.exec("uci -q get vnstat.@vnstat[0].backup")) == "1" then %>checked<% end %>>
|
||||
<input type="checkbox" name="savevnstat" class="cbi-input-checkbox" value="1" <% if luci.util.trim(luci.sys.exec("uci -q get openmptcprouter.settings.vnstat_backup")) == "1" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Save vnstats statistics on disk%>
|
||||
|
|
@ -214,6 +258,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable tracebox test%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="disabletracebox" class="cbi-input-checkbox" value="0" <% if luci.model.uci.cursor():get("openmptcprouter","settings","tracebox") == "0" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Disable multipath test using tracebox%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Debug%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
-- along with OverTheBox. If not, see (http://www.gnu.org/licenses/)
|
||||
-%>
|
||||
<%
|
||||
-- Copyright 2018 Ycarus (Yannick Chabanois) ycarus@zugaina.org
|
||||
-- Copyright 2018-2020 Ycarus (Yannick Chabanois) ycarus@zugaina.org for OpenMPTCProuter
|
||||
--
|
||||
-- Small changes to make this work with OpenMPTCProuter
|
||||
-- New features:
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
}
|
||||
function formatBytes(a,b=2){if(0===a)return"0 Bytes";const c=0>b?0:b,d=Math.floor(Math.log(a)/Math.log(1024));return parseFloat((a/Math.pow(1024,d)).toFixed(c))+" "+["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"][d]}
|
||||
XHR.poll(20, '/cgi-bin/luci/admin/system/openmptcprouter/interfaces_status', null,
|
||||
XHR.poll(20, '<%=build_url("admin/system/openmptcprouter/interfaces_status")%>', null,
|
||||
function(x, mArray)
|
||||
{
|
||||
var status = document.getElementById('openmptcprouter_status');
|
||||
|
|
@ -72,12 +72,12 @@
|
|||
{
|
||||
if (mArray.openmptcprouter.remote_from_lease == false)
|
||||
{
|
||||
var title = String.format("%s (%s)",'You', mArray.openmptcprouter.remote_addr);
|
||||
var title = String.format("%s (%s)",'<%:You%>', mArray.openmptcprouter.remote_addr);
|
||||
var statusMessageClass = "warning";
|
||||
var statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
|
||||
var statusMessage = _('Your IP was not leased by this router');
|
||||
var statusMessage = '<%:Your IP was not leased by this router%>';
|
||||
} else {
|
||||
var title = String.format('<br /><strong>%s (%s)</strong>', mArray.openmptcprouter.remote_hostname ? mArray.openmptcprouter.remote_hostname : _('You'), mArray.openmptcprouter.remote_addr)
|
||||
var title = String.format('<br /><strong>%s (%s)</strong>', mArray.openmptcprouter.remote_hostname ? mArray.openmptcprouter.remote_hostname : _('<%:You%>'), mArray.openmptcprouter.remote_addr)
|
||||
var statusMessageClass = "";
|
||||
var statusIcon = "<%=resource%>/openmptcprouter/images/statusOK.png";
|
||||
var statusMessage = "";
|
||||
|
|
@ -116,24 +116,24 @@
|
|||
content += "Version " + mArray.openmptcprouter.version;
|
||||
if (mArray.openmptcprouter.latest_version_omr != mArray.openmptcprouter.version && mArray.openmptcprouter.latest_version_omr != "")
|
||||
{
|
||||
content += "<br><i>(" + _('Latest available version') + " " + mArray.openmptcprouter.latest_version_omr + ")</i>";
|
||||
content += "<br><i>(" + '<%:Latest available version%>' + " " + mArray.openmptcprouter.latest_version_omr + ")</i>";
|
||||
}
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.loadavg)
|
||||
{
|
||||
content += _('Load:') + " " + mArray.openmptcprouter.loadavg;
|
||||
content += '<%:Load:%>' + " " + mArray.openmptcprouter.loadavg;
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.core_temp)
|
||||
{
|
||||
content += _('Core temp:') + " " + (mArray.openmptcprouter.core_temp / 1000).toFixed(1) + " °";
|
||||
content += '<%:Core temp:%>' + " " + (mArray.openmptcprouter.core_temp / 1000).toFixed(1) + " °";
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.uptime)
|
||||
{
|
||||
var date = new Date(null);
|
||||
content += _('Uptime:') + " " + String.format('%t', mArray.openmptcprouter.uptime);
|
||||
content += '<%:Uptime:%>' + " " + String.format('%t', mArray.openmptcprouter.uptime);
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.dhcpd)
|
||||
|
|
@ -141,38 +141,46 @@
|
|||
for ( dhcpd in mArray.openmptcprouter.dhcpd )
|
||||
{
|
||||
var dhcp = mArray.openmptcprouter.dhcpd[dhcpd];
|
||||
content += String.format('<span style="text-transform:capitalize;">%s</span> %s %s<br />', dhcp.interface, _('address:') ,dhcp.router);
|
||||
content += String.format('<span style="text-transform:capitalize;">%s</span> %s %s - %s<br />', dhcp.interface, _('range:'), dhcp.range_start, dhcp.range_end);
|
||||
content += String.format('<span style="text-transform:capitalize;">%s</span> %s %s<br />', dhcp.interface, '<%:address:%>' ,dhcp.router);
|
||||
content += String.format('<span style="text-transform:capitalize;">%s</span> %s %s - %s<br />', dhcp.interface, '<%:range:%>', dhcp.range_start, dhcp.range_end);
|
||||
}
|
||||
}
|
||||
|
||||
if (mArray.openmptcprouter.socks_service_enabled == true && mArray.openmptcprouter.service_addr != "")
|
||||
if (mArray.openmptcprouter.shadowsocks_enabled == true && mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.socks_service == false)
|
||||
if (mArray.openmptcprouter.shadowsocks_service == false)
|
||||
{
|
||||
statusMessage += _('ShadowSocks is not running');
|
||||
if (mArray.openmptcprouter.socks_service_key == false && mArray.openmptcprouter.socks_service_method !== "none")
|
||||
statusMessage += '<%:ShadowSocks is not running%>';
|
||||
if (mArray.openmptcprouter.shadowsocks_service_key == false && mArray.openmptcprouter.shadowsocks_service_method !== "none")
|
||||
{
|
||||
statusMessage += ' <i>(' + _('empty key') + ')</i>';
|
||||
statusMessage += ' <i>(' + '<%:empty key%>' + ')</i>';
|
||||
}
|
||||
statusMessage += '<br/>';
|
||||
}
|
||||
}
|
||||
if (mArray.openmptcprouter.v2ray_enabled == true && mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.v2ray_service == false)
|
||||
{
|
||||
statusMessage += '<%:V2Ray is not running%>';
|
||||
statusMessage += '<br/>';
|
||||
}
|
||||
}
|
||||
if (mArray.openmptcprouter.fsro == true)
|
||||
{
|
||||
statusMessage += _('Filesystem is readonly') + '<br/>';
|
||||
statusMessage += '<%:Filesystem is readonly%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.multi_vpn == true)
|
||||
{
|
||||
statusMessage += _('More than one default VPN is enabled') + '<br/>';
|
||||
statusMessage += '<%:More than one default VPN is enabled%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.tun_service == false && mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
statusMessage += _('VPN is not running') + '<br/>';
|
||||
statusMessage += '<%:VPN is not running%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.dns == false)
|
||||
{
|
||||
statusMessage += _('DNS issue: can\'t resolve hostname') + '<br/>';
|
||||
statusMessage += '<%:DNS issue: can\'t resolve hostname%>' + '<br/>';
|
||||
}
|
||||
|
||||
if(statusMessage !== "")
|
||||
|
|
@ -181,22 +189,22 @@
|
|||
statusIcon = "<%=resource%>/openmptcprouter/images/statusError.png";
|
||||
} else if (mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.socks_service_enabled == false)
|
||||
if (mArray.openmptcprouter.v2ray_enabled == false && mArray.openmptcprouter.shadowsocks_enabled == false)
|
||||
{
|
||||
statusMessage += _('ShadowSocks is DISABLED') + '<br/>';
|
||||
statusMessage += '<%:Proxy is DISABLED%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.tun_state == "DOWN")
|
||||
{
|
||||
statusMessage += _('VPN tunnel DOWN') + '<br/>';
|
||||
statusMessage += '<%:VPN tunnel DOWN%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.ipv6 == "enabled")
|
||||
{
|
||||
if (mArray.openmptcprouter.tun6_state == "DOWN")
|
||||
{
|
||||
statusMessage += _('IPv6 tunnel DOWN') + '<br/>';
|
||||
statusMessage += '<%:IPv6 tunnel DOWN%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.wan_addr6 == '')
|
||||
{
|
||||
statusMessage += _('No IPv6 access') + '<br/>';
|
||||
statusMessage += '<%:No IPv6 access%>' + '<br/>';
|
||||
}
|
||||
}
|
||||
if (statusMessage !== "")
|
||||
|
|
@ -215,7 +223,7 @@
|
|||
var equipmentIcon = '<img src="<%=resource%>/server.png" />';
|
||||
content = "";
|
||||
statusMessage = "";
|
||||
if (mArray.openmptcprouter.wan_addr == mArray.openmptcprouter.service_addr && mArray.openmptcprouter.wan_addr != "")
|
||||
if ((mArray.openmptcprouter.wan_addr == mArray.openmptcprouter.service_addr || mArray.openmptcprouter.wan_addr == mArray.openmptcprouter.service_addr_ip) && mArray.openmptcprouter.wan_addr != "")
|
||||
{
|
||||
var title = String.format("%s (%s)", mArray.openmptcprouter.vps_hostname, mArray.openmptcprouter.wan_addr);
|
||||
} else if (mArray.openmptcprouter.wan_addr != "" && mArray.openmptcprouter.service_addr == "127.0.0.1")
|
||||
|
|
@ -232,16 +240,16 @@
|
|||
} else if (mArray.openmptcprouter.external_check == false) {
|
||||
var title = String.format("%s ?", mArray.openmptcprouter.vps_hostname);
|
||||
} else {
|
||||
var title = _('No output');
|
||||
statusMessage += _('No output') + '<br/>';
|
||||
var title = '<%:No output%>';
|
||||
statusMessage += '<%:No output%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.wan_addr == "" && mArray.openmptcprouter.ss_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += _('No server IP address, No WAN IP address') + '<br/>';
|
||||
statusMessage += '<%:No server IP address, No WAN IP address%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.service_addr !== "" && mArray.openmptcprouter.wan_addr !== "" && mArray.openmptcprouter.vps_status == "DOWN")
|
||||
{
|
||||
statusMessage += _('Can\'t access and use server part') + '<br/>';
|
||||
statusMessage += '<%:Can\'t access and use server part%>' + '<br/>';
|
||||
}
|
||||
if (statusMessage !== "")
|
||||
{
|
||||
|
|
@ -250,21 +258,21 @@
|
|||
}
|
||||
if (mArray.openmptcprouter.service_addr == "")
|
||||
{
|
||||
statusMessage += _('No server defined') + '<br/>';
|
||||
statusMessage += '<%:No server defined%>' + '<br/>';
|
||||
} else {
|
||||
if (mArray.openmptcprouter.vps_status == "DOWN")
|
||||
{
|
||||
statusMessage += _('Can\'t ping server') + '<br/>';
|
||||
} else if (mArray.openmptcprouter.socks_service_enabled == true && mArray.openmptcprouter.ss_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
statusMessage += '<%:Can\'t ping server%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.shadowsocks_enabled == true && mArray.openmptcprouter.ss_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += _('Can\'t get public IP address from ShadowSocks') + '<br/>';
|
||||
statusMessage += '<%:Can\'t get public IP address from ShadowSocks%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.wan_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += _('No WAN IP address detected in less than 1 second') + '<br/>';
|
||||
statusMessage += '<%:No WAN IP address detected in less than 1 second%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.vps_admin == false)
|
||||
{
|
||||
statusMessage += _('Can\'t contact Server Admin Script');
|
||||
statusMessage += '<%:Can\'t contact Server Admin Script%>';
|
||||
if (mArray.openmptcprouter.vps_admin_error_msg !== "")
|
||||
{
|
||||
statusMessage += ' <i>(' + mArray.openmptcprouter.vps_admin_error_msg + ')</i>';
|
||||
|
|
@ -273,11 +281,11 @@
|
|||
}
|
||||
if (mArray.openmptcprouter.vps_mptcp == "0")
|
||||
{
|
||||
statusMessage += _('MPTCP is not enabled on the server') + '<br/>';
|
||||
statusMessage += '<%:MPTCP is not enabled on the server%>' + '<br/>';
|
||||
}
|
||||
if (mArray.openmptcprouter.vps_time_accurate == false)
|
||||
{
|
||||
statusMessage += _('Big time difference between the server and the router') + '<br/>';
|
||||
statusMessage += '<%:Big time difference between the server and the router%>' + '<br/>';
|
||||
}
|
||||
}
|
||||
if (statusMessage !== "" && statusMessageClass !== "error")
|
||||
|
|
@ -287,52 +295,52 @@
|
|||
}
|
||||
if (mArray.openmptcprouter.vps_omr_version)
|
||||
{
|
||||
content += _('Version') + " " + mArray.openmptcprouter.vps_omr_version;
|
||||
content += '<%:Version%>' + " " + mArray.openmptcprouter.vps_omr_version;
|
||||
if (mArray.openmptcprouter.vps_kernel)
|
||||
{
|
||||
content += " " + mArray.openmptcprouter.vps_kernel;
|
||||
}
|
||||
if (mArray.openmptcprouter.latest_version_vps !== mArray.openmptcprouter.vps_omr_version && mArray.openmptcprouter.latest_version_vps !== "")
|
||||
{
|
||||
content += "<br><i>(" + _('Latest available version') + " " + mArray.openmptcprouter.latest_version_vps + ")</i>";
|
||||
content += "<br><i>(" + '<%:Latest available version%>' + " " + mArray.openmptcprouter.latest_version_vps + ")</i>";
|
||||
}
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.vps_loadavg)
|
||||
{
|
||||
content += _('Load:') + " " + mArray.openmptcprouter.vps_loadavg;
|
||||
content += '<%:Load:%>' + " " + mArray.openmptcprouter.vps_loadavg;
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.vps_uptime)
|
||||
{
|
||||
var date = new Date(null);
|
||||
content += _('Uptime:') + " " + String.format('%t', mArray.openmptcprouter.vps_uptime);
|
||||
content += '<%:Uptime:%>' + " " + String.format('%t', mArray.openmptcprouter.vps_uptime);
|
||||
content += "<br />";
|
||||
}
|
||||
if (mArray.openmptcprouter.server_mptcp == "disabled")
|
||||
{
|
||||
statusMessage += _('MPTCP may not be enabled on the server') + '<br/>';
|
||||
statusMessage += '<%:MPTCP may not be enabled on the server%>' + '<br/>';
|
||||
statusMessageClass = "warning";
|
||||
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
|
||||
}
|
||||
if (mArray.openmptcprouter.wan_addr6)
|
||||
{
|
||||
content += _('IPv6:') + " " + mArray.openmptcprouter.wan_addr6;
|
||||
content += '<%:IPv6:%>' + " " + mArray.openmptcprouter.wan_addr6;
|
||||
content += '<br />';
|
||||
}
|
||||
if (mArray.openmptcprouter.socks_service_enabled == true && mArray.openmptcprouter.ss_traffic && mArray.openmptcprouter.ss_traffic != 0)
|
||||
if (mArray.openmptcprouter.proxy_traffic && mArray.openmptcprouter.proxy_traffic != 0)
|
||||
{
|
||||
content += _('Shadowsocks traffic:') + " " + formatBytes(mArray.openmptcprouter.ss_traffic);
|
||||
content += '<%:Proxy traffic:%>' + " " + formatBytes(mArray.openmptcprouter.proxy_traffic);
|
||||
content += '<br />';
|
||||
}
|
||||
if (mArray.openmptcprouter.vpn_traffic && mArray.openmptcprouter.vpn_traffic != 0)
|
||||
{
|
||||
content += _('VPN traffic:') + " " + formatBytes(mArray.openmptcprouter.vpn_traffic);
|
||||
content += '<%:VPN traffic:%>' + " " + formatBytes(mArray.openmptcprouter.vpn_traffic);
|
||||
content += '<br />';
|
||||
}
|
||||
if (mArray.openmptcprouter.ss_traffic && mArray.openmptcprouter.vpn_traffic && mArray.openmptcprouter.vpn_traffic != 0 && mArray.openmptcprouter.ss_traffic != 0)
|
||||
if (mArray.openmptcprouter.total_traffic && mArray.openmptcprouter.total_traffic != 0)
|
||||
{
|
||||
content += _('Total traffic:') + " " + formatBytes(mArray.openmptcprouter.vpn_traffic + mArray.openmptcprouter.ss_traffic);
|
||||
content += '<%:Total traffic:%>' + " " + formatBytes(mArray.openmptcprouter.total_traffic);
|
||||
content += '<br />';
|
||||
}
|
||||
content += '<br />';
|
||||
|
|
@ -428,35 +436,35 @@
|
|||
var content = "";
|
||||
if(ipaddr !== '')
|
||||
{
|
||||
content += String.format('%s <strong>%s</strong><br />',_('ip address:'), ipaddr);
|
||||
content += String.format('%s <strong>%s</strong><br />','<%:ip address:%>', ipaddr);
|
||||
}
|
||||
if(wanip !== '')
|
||||
{
|
||||
content += String.format('%s <strong>%s</strong><br />',_('wan address:'), wanip);
|
||||
content += String.format('%s <strong>%s</strong><br />','<%:wan address:%>', wanip);
|
||||
}
|
||||
if(whois !== '')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('whois:'), whois);
|
||||
content += String.format('%s %s<br />','<%:whois:%>', whois);
|
||||
}
|
||||
if(latency !== '')
|
||||
{
|
||||
content += String.format('%s %s ms<br />',_('latency:'), latency);
|
||||
content += String.format('%s %s ms<br />','<%:latency:%>', latency);
|
||||
}
|
||||
if(mtu !== '')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('mtu:'), mtu);
|
||||
content += String.format('%s %s<br />','<%:mtu:%>', mtu);
|
||||
}
|
||||
if (operator !== '')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('operator:'), operator);
|
||||
content += String.format('%s %s<br />','<%:operator:%>', operator);
|
||||
}
|
||||
if (phonenumber !== '' && anonymize !== 'true')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('phone number:'), phonenumber);
|
||||
content += String.format('%s %s<br />','<%:phone number:%>', phonenumber);
|
||||
}
|
||||
if (donglestate !== '')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('state:'), donglestate);
|
||||
content += String.format('%s %s<br />','<%:state:%>', donglestate);
|
||||
}
|
||||
|
||||
if(signal !== '')
|
||||
|
|
@ -478,64 +486,64 @@
|
|||
}
|
||||
if(ipaddr == '')
|
||||
{
|
||||
statusMessage += _('No IP defined') + '<br />';
|
||||
statusMessage += '<%:No IP defined%>' + '<br />';
|
||||
}
|
||||
if(gateway == '')
|
||||
{
|
||||
statusMessage += _('No gateway defined') + '<br />';
|
||||
statusMessage += '<%:No gateway defined%>' + '<br />';
|
||||
} else if(gw_ping == 'DOWN')
|
||||
{
|
||||
statusMessage += _('Gateway DOWN') + '<br />';
|
||||
statusMessage += '<%:Gateway DOWN%>' + '<br />';
|
||||
} else if(multipath_available == 'ERROR')
|
||||
{
|
||||
statusMessage += _('Multipath seems to be blocked on the connection') + '<br />';
|
||||
statusMessage += '<%:Multipath seems to be blocked on the connection%>' + '<br />';
|
||||
}
|
||||
if(server_ping == 'DOWN' && mArray.openmptcprouter.service_addr !== "")
|
||||
{
|
||||
statusMessage += _('No Server ping response after 1 second') + '<br />';
|
||||
statusMessage += '<%:No Server ping response after 1 second%>' + '<br />';
|
||||
}
|
||||
if (stat == 'Offline' && ipaddr != '' && ipaddr == mArray.wans[i].gateway)
|
||||
{
|
||||
statusMessage += _('Wan IP and gateway are identical') + '<br />';
|
||||
statusMessage += '<%:Wan IP and gateway are identical%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(multipath == 'master')
|
||||
{
|
||||
if (master > 1)
|
||||
{
|
||||
statusMessage += _('Multipath master already defined') + '<br />';
|
||||
statusMessage += '<%:Multipath master already defined%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(multipath_state !== 'on' && multipath_state !== '')
|
||||
{
|
||||
statusMessage += _('Multipath current state is ') + multipath_state + '<br />';
|
||||
statusMessage += '<%:Multipath current state is %>' + multipath_state + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
} else {
|
||||
if(multipath !== multipath_state && multipath_state !== '')
|
||||
{
|
||||
statusMessage += _('Multipath current state is ') + multipath_state + '<br />';
|
||||
statusMessage += '<%:Multipath current state is %>' + multipath_state + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
}
|
||||
if(duplicateif)
|
||||
{
|
||||
statusMessage += _('Network interface duplicated') + '<br />';
|
||||
statusMessage += '<%:Network interface duplicated%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(ipv6_discover == 'DETECTED')
|
||||
{
|
||||
statusMessage += _('IPv6 route received') + '<br />'
|
||||
statusMessage += '<%:IPv6 route received%>' + '<br />'
|
||||
}
|
||||
if (statusMessage !== "" && statusMessageClass !== "error")
|
||||
{
|
||||
statusMessageClass = "warning";
|
||||
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
|
||||
}
|
||||
content += String.format('multipath: %s<br />',multipath);
|
||||
content += String.format('<%:multipath:%> %s<br />',multipath);
|
||||
if(mArray.wans[i].qos && mArray.wans[i].download > 0 && mArray.wans[i].upload > 0)
|
||||
{
|
||||
content += String.format('%s %s/%s kbps (%s)',_('traffic control:'), mArray.wans[i].download, mArray.wans[i].upload, mArray.wans[i].qos)
|
||||
content += String.format('%s %s/%s kbps (%s)','<%:traffic control:%>', mArray.wans[i].download, mArray.wans[i].upload, mArray.wans[i].qos)
|
||||
}
|
||||
temp += getNetworkNodeTemplate(equipmentIcon, statusIcon, title, statusMessageClass,statusMessage,content);
|
||||
|
||||
|
|
@ -619,79 +627,79 @@
|
|||
var content = "";
|
||||
if(ipaddr !== '')
|
||||
{
|
||||
content += String.format('%s <strong>%s</strong><br />',_('ip address:'), ipaddr);
|
||||
content += String.format('%s <strong>%s</strong><br />','<%:ip address:%>', ipaddr);
|
||||
}
|
||||
if(wanip !== '')
|
||||
{
|
||||
content += String.format('%s <strong>%s</strong><br />',_('wan address:'), wanip);
|
||||
content += String.format('%s <strong>%s</strong><br />','<%:wan address:%>', wanip);
|
||||
}
|
||||
if(whois !== '')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('whois:'), whois);
|
||||
content += String.format('%s %s<br />','<%:whois:%>', whois);
|
||||
}
|
||||
if(latency !== '')
|
||||
{
|
||||
content += String.format('%s %s ms<br />',_('latency:'), latency);
|
||||
content += String.format('%s %s ms<br />','<%:latency:%>', latency);
|
||||
}
|
||||
if(mtu !== '')
|
||||
{
|
||||
content += String.format('%s %s<br />',_('mtu:'), mtu);
|
||||
content += String.format('%s %s<br />','<%:mtu:%>', mtu);
|
||||
}
|
||||
if(ipaddr == '')
|
||||
{
|
||||
statusMessage += _('No IP defined') + '<br />'
|
||||
statusMessage += '<%:No IP defined%>' + '<br />'
|
||||
}
|
||||
if(gateway == '')
|
||||
{
|
||||
statusMessage += _('No gateway defined') + '<br />'
|
||||
statusMessage += '<%:No gateway defined%>' + '<br />'
|
||||
} else if(gw_ping == 'DOWN')
|
||||
{
|
||||
statusMessage += _('Gateway DOWN') + '<br />'
|
||||
statusMessage += '<%:Gateway DOWN%>' + '<br />'
|
||||
} else if(multipath_available == 'ERROR')
|
||||
{
|
||||
statusMessage += _('Multipath seems to be blocked on the connection') + '<br />'
|
||||
statusMessage += '<%:Multipath seems to be blocked on the connection%>' + '<br />'
|
||||
}
|
||||
if(server_ping == 'DOWN')
|
||||
{
|
||||
statusMessage += _('No Server ping response after 1 second') + '<br />'
|
||||
statusMessage += '<%:No Server ping response after 1 second%>' + '<br />'
|
||||
}
|
||||
if (stat == 'Offline' && ipaddr != '' && ipaddr == mArray.tunnels[i].gateway)
|
||||
{
|
||||
statusMessage += _('Wan IP and gateway are identical') + '<br />';
|
||||
statusMessage += '<%:Wan IP and gateway are identical%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(multipath == 'master')
|
||||
{
|
||||
if (master > 1)
|
||||
{
|
||||
statusMessage += _('Multipath master already defined') + '<br />';
|
||||
statusMessage += '<%:Multipath master already defined%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(multipath_state !== 'on' && multipath_state !== '')
|
||||
{
|
||||
statusMessage += _('Multipath current state is ') + multipath_state + '<br />';
|
||||
statusMessage += '<%:Multipath current state is %>' + multipath_state + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
} else {
|
||||
if(multipath !== multipath_state && multipath_state !== '')
|
||||
{
|
||||
statusMessage += _('Multipath current state is ') + multipath_state + '<br />';
|
||||
statusMessage += '<%:Multipath current state is %>' + multipath_state + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
}
|
||||
if(duplicateif)
|
||||
{
|
||||
statusMessage += _('Network interface duplicated') + '<br />';
|
||||
statusMessage += '<%:Network interface duplicated%>' + '<br />';
|
||||
statusMessageClass = "error";
|
||||
}
|
||||
if(ipv6_discover == 'DETECTED')
|
||||
{
|
||||
statusMessage += _('IPv6 route received') + '<br />'
|
||||
statusMessage += '<%:IPv6 route received%>' + '<br />'
|
||||
}
|
||||
content += String.format('multipath: %s<br />',multipath);
|
||||
content += String.format('<%:multipath:%> %s<br />',multipath);
|
||||
if(mArray.tunnels[i].qos && mArray.tunnels[i].download > 0 && mArray.tunnels[i].upload > 0)
|
||||
{
|
||||
content += String.format('%s %s/%s kbps (%s)',_('traffic control:'), mArray.tunnels[i].download, mArray.tunnels[i].upload, mArray.tunnels[i].qos)
|
||||
content += String.format('%s %s/%s kbps (%s)','<%:traffic control:%>', mArray.tunnels[i].download, mArray.tunnels[i].upload, mArray.tunnels[i].qos)
|
||||
}
|
||||
temp += getNetworkNodeTemplate(equipmentIcon, statusIcon, title, statusMessageClass,statusMessage,content);
|
||||
|
||||
|
|
@ -701,7 +709,7 @@
|
|||
temp += '</tr></table>';
|
||||
}
|
||||
if (mArray === null) {
|
||||
temp += _('No data');
|
||||
temp += '<%:No data%>';
|
||||
}
|
||||
temp += '</li>';
|
||||
// Close tree
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ end
|
|||
<div class="cbi-value-field">
|
||||
<input name="<%=servername%>.server_ip" id="<%=servername%>.server_ip" placeholder="<%:Server IP%>" class="cbi-input-text" value="<%=uci:get("openmptcprouter",servername,"ip")%>" data-optional="false">
|
||||
<div class="cbi-value-description">
|
||||
<%:Server IP will be set for ShadowSocks, Glorytun, OpenVPN and MLVPN%>
|
||||
<%:Server IP will be set for proxy and VPN%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -125,7 +125,7 @@ end
|
|||
<div>
|
||||
<input type="text" class="cbi-section-create-name" id="cbi.cts.omr-bypass.server." name="add_server_name" data-type="uciname" data-optional="true" />
|
||||
</div>
|
||||
<input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" name="add_server" value="<%:Add server%>" />
|
||||
<input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" name="add_server" value="<%:Add a new server%>" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
@ -175,23 +175,42 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="cbi-section" id="shadowsocks">
|
||||
<legend><%:ShadowSocks settings%></legend>
|
||||
<div class="cbi-section-descr"><%:By default ShadowSocks is used for TCP traffic.%></div>
|
||||
<fieldset class="cbi-section" id="proxy">
|
||||
<legend><%:Proxy settings%></legend>
|
||||
<div class="cbi-section-descr"><%:By default proxy is used for any traffic that is TCP (and UDP for V2Ray).%></div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Default Proxy%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" name="default_proxy" size="1">
|
||||
<% if nixio.fs.access("/etc/init.d/shadowsocks-libev") then %><option value="shadowsocks" <% if uci:get("shadowsocks-libev","sss0","disabled") == "0" or uci:get("openmptcprouter","settings","proxy") == nil then %>selected="selected"<% end %>>Shadowsocks</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray" <% if uci:get("v2ray","main","enabled") == "1" then %>selected="selected"<% end %>>V2Ray</option><% end %>
|
||||
<option value="none" <% if uci:get("shadowsocks-libev","sss0","disabled") ~= "0" and uci:get("v2ray","main","enabled") ~= "1" and uci:get("openmptcprouter","settings","proxy") ~= nil then %>selected="selected"<% end %>>None</option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Set the default Proxy used for TCP when ShadowSocks is enabled, for TCP and UDP when V2Ray is enabled.%>
|
||||
</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")%>" />
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Key is retrieved from server API by default. ShadowSocks is used for TCP.%>
|
||||
<%:Key is retrieved from server API by default.%> <%:ShadowSocks is used for TCP.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Disable ShadowSocks%></label>
|
||||
<label class="cbi-value-title"><%:V2Ray user id%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="disableshadowsocks" value="1" <% if uci:get("shadowsocks-libev","sss0","disabled") == "1" then %>checked<% end %> />
|
||||
<input type="text" name="v2ray_user" placeholder="<%:V2Ray user%>" class="cbi-input-text" value="<%=uci:get("v2ray","omrout","s_vmess_user_id")%>" />
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Key is retrieved from server API by default.%> <%:V2Ray is used for TCP and UDP.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
|
|
@ -216,7 +235,7 @@ end
|
|||
<% else %>
|
||||
<%:There is no Advanced Encryption Standard (AES) instruction set integrated in the processor, you should use chacha20.%>
|
||||
<% end %>
|
||||
<%:Encryption method is also used for Glorytun and OpenVPN.%>
|
||||
<%:Encryption method is used for Shadowsocks, V2Ray, Glorytun and OpenVPN.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -231,7 +250,7 @@ end
|
|||
<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">
|
||||
<%:Key is retrieved from server API by default. Glorytun TCP is used by default for UDP and ICMP%>
|
||||
<%:Key is retrieved from server API by default.%> <%:Glorytun TCP is used by default for UDP and ICMP%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -243,7 +262,7 @@ end
|
|||
<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">
|
||||
<%:Key is retrieved from server API by default. A Dead Simple VPN is a TCP VPN that can replace Glorytun TCP%>
|
||||
<%:Key is retrieved from server API by default.%> <%:A Dead Simple VPN is a TCP VPN that can replace Glorytun TCP%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -255,7 +274,7 @@ end
|
|||
<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">
|
||||
<%:Key is retrieved from server API by default. MLVPN can replace Glorytun with connections with same latency%>
|
||||
<%:Key is retrieved from server API by default.%> <%:MLVPN can replace Glorytun with connections with same latency%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -267,7 +286,7 @@ end
|
|||
<input type="text" name="ubond_password" placeholder="<%:UBOND password%>" class="cbi-input-text" value="<%=uci:get("ubond","general","password")%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Key is retrieved from server API by default. UBOND can replace Glorytun with connections with same latency%>
|
||||
<%:Key is retrieved from server API by default.%> <%:UBOND can replace Glorytun with connections with same latency%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -291,7 +310,7 @@ 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 %>
|
||||
<% 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 == "ubond" then %>
|
||||
<% if nixio.fs.access("/usr/sbin/ubond") then %><option value="ubond" <% if uci:get("ubond","general","enable") == "1" then %>selected="selected"<% end %>>UBOND</option><% end %>
|
||||
<% elseif vpn == "openvpn" then %>
|
||||
|
|
@ -307,7 +326,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/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/ubond") then %><option value="ubond" <% if uci:get("ubond","general","enable") == "1" then %>selected="selected"<% end %>>UBOND</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>
|
||||
|
|
@ -323,16 +342,122 @@ end
|
|||
</div>
|
||||
</fieldset>
|
||||
</span>
|
||||
<hr />
|
||||
<fieldset class="cbi-section" id="laninterfaces">
|
||||
<legend><%:LAN interfaces settings%></legend>
|
||||
<%
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifname = iface:name()
|
||||
local firewall_lan = luci.util.trim(luci.sys.exec("uci -q get firewall.@zone[0].network | grep " .. ifname))
|
||||
if firewall_lan ~= "" then
|
||||
%>
|
||||
<h3><%=ifname%></h3>
|
||||
<fieldset class="cbi-section-node" id="cbi-openmptcprouter-<%=ifname%>">
|
||||
<input type="hidden" name="intf.<%=ifname%>" value="<%=ifname%>" />
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-label" data-index="1">
|
||||
<label class="cbi-value-title"><%:Label%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="hidden" id="cbid.network.<%=ifname%>.lan" name="cbid.network.<%=ifname%>.lan" value="1">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.label" name="cbid.network.<%=ifname%>.label" class="cbi-input-text" value="<%=uci:get("network",ifname,"label")%>">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Label for the interface%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-proto" data-index="3">
|
||||
<label class="cbi-value-title"><%:Protocol%></label>
|
||||
<div class="cbi-value-field">
|
||||
<% findproto = 0 %>
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.proto" name="cbid.network.<%=ifname%>.proto" size="1">
|
||||
<option id="cbid.network.<%=ifname%>.proto-static" value="static"<% if uci:get("network",ifname,"proto") == "static" or uci:get("network",ifname,"proto") == "" then findproto = 1 %> selected="selected"<% end %>><%:Static address%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-dhcp" value="dhcp"<% if uci:get("network",ifname,"proto") == "dhcp" then findproto = 1 %> selected="selected"<% end %>><%:DHCP%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-other" value="other"<% if uci:get("network",ifname,"proto") ~= nil and findproto ~= 1 then %> selected="selected"<% end %>><%:Other%></option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:You can use DHCP if you have multiple real ethernet ports.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
if uci:get("network",ifname,"type") ~= "bridge" then
|
||||
%>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-intf" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.proto":"dhcp"}]" data-index="4">
|
||||
<label class="cbi-value-title"><%:Physical interface%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
for _, ifacea in ipairs(ifaces) do
|
||||
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) then
|
||||
if uci:get("network",ifname,"proto") ~= "macvlan" then
|
||||
%>
|
||||
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"masterintf") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
end
|
||||
if uci:get("network",ifname,"proto") ~= "macvlan" then
|
||||
if iffind == 0 and uci:get("network",ifname,"ifname") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option>
|
||||
<%
|
||||
end
|
||||
else
|
||||
if iffind == 0 and uci:get("network",ifname,"masterintf") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"masterintf")%>" selected="selected"><%=uci:get("network",ifname,"masterintf")%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Choose physical interface.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-address" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="5">
|
||||
<label class="cbi-value-title"><%:IPv4 address%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ipaddr" name="cbid.network.<%=ifname%>.ipaddr" class="cbi-input-text" value="<%=uci:get("network",ifname,"ipaddr")%>" data-type="ip4addr">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-netmask" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="6">
|
||||
<label class="cbi-value-title"><%:IPv4 netmask%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.netmask" name="cbid.network.<%=ifname%>.netmask" class="cbi-input-text" value="<%=uci:get("network",ifname,"netmask") or "255.255.255.0"%>" data-type="ip4addr">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
|
||||
<hr />
|
||||
<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>
|
||||
<%
|
||||
for _, iface in ipairs(net:get_networks()) do
|
||||
local ifname = iface:name()
|
||||
local multipath = uci:get("network",ifname,"multipath")
|
||||
local multipathvpn = uci:get("openmptcprouter",ifname,"multipathvpn")
|
||||
local vpn = uci:get("openmptcprouter",ifname,"vpn")
|
||||
if (multipath ~= nil and multipath ~= "off" and vpn ~= "1") or multipathvpn == "1" then
|
||||
local firewall_wan = luci.util.trim(luci.sys.exec("uci -q get firewall.@zone[1].network | grep " .. ifname))
|
||||
if firewall_wan ~= "" then
|
||||
|
||||
-- local multipath = uci:get("network",ifname,"multipath")
|
||||
-- local multipathvpn = uci:get("openmptcprouter",ifname,"multipathvpn")
|
||||
-- local vpn = uci:get("openmptcprouter",ifname,"vpn")
|
||||
-- if (multipath ~= nil and multipath ~= "off" and vpn ~= "1") or multipathvpn == "1" then
|
||||
%>
|
||||
<div class="cbi-section-remove right">
|
||||
<input type="submit" name="delete.<%=ifname%>" value="<%:Delete%>" class="cbi-button" />
|
||||
|
|
@ -350,13 +475,53 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-proto" data-index="2">
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-type" data-index="2">
|
||||
<label class="cbi-value-title"><%:Type%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.type" name="cbid.network.<%=ifname%>.type" size="1">
|
||||
<option id="cbid.network.<%=ifname%>.type-normal" value="normal"><%:Normal%></option>
|
||||
<option id="cbid.network.<%=ifname%>.type-macvlan" value="macvlan"<% if uci:get("network",ifname,"type") == "macvlan" then %> selected="selected"<% end %>><%:MacVLAN%></option>
|
||||
<option id="cbid.network.<%=ifname%>.type-bridge" value="bridge"<% if uci:get("network",ifname,"type") == "bridge" then %> selected="selected"<% end %>><%:Bridge%></option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Choose MacVLAN if you want to create a virtual interface based on a physical interface.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-masterintf" data-depends="[{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="3">
|
||||
<label class="cbi-value-title"><%:Physical interface%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.masterintf" name="cbid.network.<%=ifname%>.masterintf" size="1">
|
||||
<%
|
||||
for _, ifacea in ipairs(ifaces) do
|
||||
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) then
|
||||
%>
|
||||
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"masterintf") == ifacea then %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Choose physical interface.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-proto" data-depends="[{"cbid.network.<%=ifname%>.type":"normal"},{"cbid.network.<%=ifname%>.type":"bridge"}]" data-index="3">
|
||||
<label class="cbi-value-title"><%:Protocol%></label>
|
||||
<div class="cbi-value-field">
|
||||
<% findproto = 0 %>
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.proto" name="cbid.network.<%=ifname%>.proto" size="1">
|
||||
<option id="cbid.network.<%=ifname%>.proto-static" value="static"<% if uci:get("network",ifname,"proto") == "static" then %> selected="selected"<% end %>><%:Static address%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-dhcp" value="dhcp"<% if uci:get("network",ifname,"proto") == "dhcp" then %> selected="selected"<% end %>><%:DHCP%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-other" value="other"<% if uci:get("network",ifname,"proto") ~= "static" and uci:get("network",ifname,"proto") ~= "dhcp" then %> selected="selected"<% end %>><%:Other%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-static" value="static"<% if uci:get("network",ifname,"proto") == "static" or uci:get("network",ifname,"proto") == nil then findproto = 1 %> selected="selected"<% end %>><%:Static address%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-dhcp" value="dhcp"<% if uci:get("network",ifname,"proto") == "dhcp" then findproto = 1 %> selected="selected"<% end %>><%:DHCP%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-modemmanager" value="modemmanager"<% if uci:get("network",ifname,"proto") == "modemmanager" then findproto = 1 %> selected="selected"<% end %>><%:ModemManager%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-ncm" value="ncm"<% if uci:get("network",ifname,"proto") == "ncm" then findproto = 1 %> selected="selected"<% end %>><%:NCM%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-pppoe" value="pppoe"<% if uci:get("network",ifname,"proto") == "pppoe" then findproto = 1 %> selected="selected"<% end %>><%:PPPoE%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-qmi" value="qmi"<% if uci:get("network",ifname,"proto") == "qmi" then findproto = 1 %> selected="selected"<% end %>><%:QMI%></option>
|
||||
<option id="cbid.network.<%=ifname%>.proto-other" value="other"<% if uci:get("network",ifname,"proto") ~= nil and findproto ~= 1 then %> selected="selected"<% end %>><%:Other%></option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
|
|
@ -364,7 +529,34 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-address" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"}]" data-index="3">
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-intf" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.proto":"dhcp"}]" data-index="4">
|
||||
<label class="cbi-value-title"><%:Physical interface%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.intf" name="cbid.network.<%=ifname%>.intf" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
for _, ifacea in ipairs(ifaces) do
|
||||
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*") or ifacea:match("^tun.*")) and device_notvirtual(ifacea) then
|
||||
%>
|
||||
<option value="<%=ifacea%>"<% if uci:get("network",ifname,"ifname") == ifacea then iffind = 1 %> selected="selected"<% end %>><%=ifacea%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
if iffinf == 0 and uci:get("network",ifname,"ifname") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"ifname")%>" selected="selected"><%=uci:get("network",ifname,"ifname")%></option>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Choose physical interface.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-address" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="5">
|
||||
<label class="cbi-value-title"><%:IPv4 address%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.ipaddr" name="cbid.network.<%=ifname%>.ipaddr" class="cbi-input-text" value="<%=uci:get("network",ifname,"ipaddr")%>" data-type="ip4addr">
|
||||
|
|
@ -374,13 +566,13 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-netmask" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"}]" data-index="4">
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-netmask" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="6">
|
||||
<label class="cbi-value-title"><%:IPv4 netmask%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.netmask" name="cbid.network.<%=ifname%>.netmask" class="cbi-input-text" value="<%=uci:get("network",ifname,"netmask") or "255.255.255.0"%>" data-type="ip4addr">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-gateway" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"}]" data-index="5">
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-gateway" data-depends="[{"cbid.network.<%=ifname%>.proto":"static"},{"cbid.network.<%=ifname%>.type":"macvlan"}]" data-index="7">
|
||||
<label class="cbi-value-title"><%:IPv4 gateway%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.gateway" name="cbid.network.<%=ifname%>.gateway" class="cbi-input-text" value="<%=uci:get("network",ifname,"gateway")%>" data-type="ip4addr">
|
||||
|
|
@ -390,6 +582,165 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-device" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"}]" data-index="5">
|
||||
<label class="cbi-value-title"><%:Device%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device" name="cbid.network.<%=ifname%>.device" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
iftty = nixio.fs.glob("/dev/ttyUSB*")
|
||||
for tty in iftty do
|
||||
%>
|
||||
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
|
||||
<%
|
||||
end
|
||||
iftty = nixio.fs.glob("/dev/cdc-wdm*")
|
||||
for tty in iftty do
|
||||
%>
|
||||
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
|
||||
<%
|
||||
end
|
||||
if iffinf == 0 and uci:get("network",ifname,"device") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-device" data-depends="[{"cbid.network.<%=ifname%>.proto":"qmi"}]" data-index="5">
|
||||
<label class="cbi-value-title"><%:Device%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device" name="cbid.network.<%=ifname%>.device" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
iftty = nixio.fs.glob("/dev/cdc-wdm*")
|
||||
for tty in iftty do
|
||||
%>
|
||||
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
|
||||
<%
|
||||
end
|
||||
if iffinf == 0 and uci:get("network",ifname,"device") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-device" data-depends="[{"cbid.network.<%=ifname%>.proto":"modemmanager"}]" data-index="5">
|
||||
<label class="cbi-value-title"><%:Device%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device" name="cbid.network.<%=ifname%>.device" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
iftty = luci.sys.exec("/usr/bin/mmcli -L")
|
||||
for listtty in iftty:gmatch("([^\r\n]*)[\r\n]") do
|
||||
modemid = luci.util.trim(luci.sys.exec("echo '" .. listtty .. "' | awk -F' ' '{print $1}' | awk -F/ '{print $6}'"))
|
||||
if modemid ~= '' then
|
||||
modeminfo = luci.sys.exec("/usr/bin/mmcli -m " .. modemid .. " --output-keyvalue")
|
||||
tty = luci.util.trim(luci.sys.exec("echo '" .. modeminfo .. "' | grep 'modem.generic.device ' | awk -F': ' '{print $2}'"))
|
||||
%>
|
||||
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
if iffinf == 0 and uci:get("network",ifname,"device") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-apn" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"},{"cbid.network.<%=ifname%>.proto":"qmi"},{"cbid.network.<%=ifname%>.proto":"modemmanager"}]" data-index="6">
|
||||
<label class="cbi-value-title"><%:APN%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.apn" name="cbid.network.<%=ifname%>.apn" class="cbi-input-text" value="<%=uci:get("network",ifname,"apn")%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-pincode" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"},{"cbid.network.<%=ifname%>.proto":"qmi"},{"cbid.network.<%=ifname%>.proto":"modemmanager"}]" data-index="7">
|
||||
<label class="cbi-value-title"><%:PIN code%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.pincode" name="cbid.network.<%=ifname%>.pincode" class="cbi-input-text" value="<%=uci:get("network",ifname,"pincode")%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-mode" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"}]" data-index="8">
|
||||
<label class="cbi-value-title"><%:Service Type%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.mode" name="cbid.network.<%=ifname%>.mode" size="1">
|
||||
<option value=""<% if uci:get("network",ifname,"mode") == "" then %> selected="selected"<% end %>><%:Modem default%></option>
|
||||
<option value="preferlte"<% if uci:get("network",ifname,"auth") == "preferlte" then %> selected="selected"<% end %>><%:Prefer LTE%></option>
|
||||
<option value="preferumts"<% if uci:get("network",ifname,"auth") == "preferumts" then %> selected="selected"<% end %>><%:Prefer UMTS%></option>
|
||||
<option value="lte"<% if uci:get("network",ifname,"auth") == "lte" then %> selected="selected"<% end %>><%:LTE%></option>
|
||||
<option value="umts"<% if uci:get("network",ifname,"auth") == "umts" then %> selected="selected"<% end %>><%:UMTS/GPRS%></option>
|
||||
<option value="gsm"<% if uci:get("network",ifname,"auth") == "gsm" then %> selected="selected"<% end %>><%:GPRS only%></option>
|
||||
<option value="auto"<% if uci:get("network",ifname,"auth") == "auto" then %> selected="selected"<% end %>><%:auto%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-auth" data-depends="[{"cbid.network.<%=ifname%>.proto":"qmi"},{"cbid.network.<%=ifname%>.proto":"pppoe"}]" data-index="9">
|
||||
<label class="cbi-value-title"><%:Authentication Type%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.auth" name="cbid.network.<%=ifname%>.auth" size="1">
|
||||
<option value="none"<% if uci:get("network",ifname,"auth") == "none" then %> selected="selected"<% end %>><%:NONE%></option>
|
||||
<option value="pap"<% if uci:get("network",ifname,"auth") == "pap" then %> selected="selected"<% end %>><%:PAP%></option>
|
||||
<option value="chap"<% if uci:get("network",ifname,"auth") == "chap" then %> selected="selected"<% end %>><%:CHAP%></option>
|
||||
<option value="both"<% if uci:get("network",ifname,"auth") == "both" then %> selected="selected"<% end %>><%:PAP/CHAP%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-username" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"},{"cbid.network.<%=ifname%>.proto":"qmi"},{"cbid.network.<%=ifname%>.proto":"pppoe"}]" data-index="10">
|
||||
<label class="cbi-value-title"><%:PAP/CHAP username%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.username" name="cbid.network.<%=ifname%>.username" class="cbi-input-text" value="<%=uci:get("network",ifname,"username")%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-password" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"},{"cbid.network.<%=ifname%>.proto":"qmi"},{"cbid.network.<%=ifname%>.proto":"pppoe"}]" data-index="11">
|
||||
<label class="cbi-value-title"><%:PAP/CHAP password%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.password" name="cbid.network.<%=ifname%>.password" class="cbi-input-text" value="<%=uci:get("network",ifname,"password")%>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-delay" data-depends="[{"cbid.network.<%=ifname%>.proto":"ncm"},{"cbid.network.<%=ifname%>.proto":"qmi"}]" data-index="12">
|
||||
<label class="cbi-value-title"><%:Modem init timeout%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" id="cbid.network.<%=ifname%>.delay" name="cbid.network.<%=ifname%>.delay" class="cbi-input-text" value="<%=uci:get("network",ifname,"delay")%>">
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then
|
||||
%>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-multipath" data-index="13">
|
||||
<label class="cbi-value-title"><%:Multipath TCP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.multipath" name="cbid.network.<%=ifname%>.multipath" size="1">
|
||||
<option value="on"<% if uci:get("network","ovpn" .. ifname,"multipath") == "on" then %> selected="selected"<% end %>><%:Enabled%></option>
|
||||
<option value="off"<% if uci:get("network","ovpn" .. ifname,"multipath") == "off" then %> selected="selected"<% end %>><%:Disabled%></option>
|
||||
<option value="master"<% if uci:get("network","ovpn" .. ifname,"multipath") == "master" then %> selected="selected"<% end %>><%:Master%></option>
|
||||
<option value="backup"<% if uci:get("network","ovpn" .. ifname,"multipath") == "backup" then %> selected="selected"<% end %>><%:Backup%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="cbi-value" id="cbi-network-<%=ifname%>-multipath" data-index="13">
|
||||
<label class="cbi-value-title"><%:Multipath TCP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.multipath" name="cbid.network.<%=ifname%>.multipath" size="1">
|
||||
<option value="on"<% if uci:get("network",ifname,"multipath") == "on" then %> selected="selected"<% end %>><%:Enabled%></option>
|
||||
<option value="off"<% if uci:get("network",ifname,"multipath") == "off" then %> selected="selected"<% end %>><%:Disabled%></option>
|
||||
<option value="master"<% if uci:get("network",ifname,"multipath") == "master" then %> selected="selected"<% end %>><%:Master%></option>
|
||||
<option value="backup"<% if uci:get("network",ifname,"multipath") == "backup" then %> selected="selected"<% end %>><%:Backup%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
|
||||
<%
|
||||
local download = "0"
|
||||
local upload = "0"
|
||||
|
|
@ -405,7 +756,7 @@ end
|
|||
end
|
||||
end
|
||||
%>
|
||||
<div class="cbi-value" data-index="6">
|
||||
<div class="cbi-value" data-index="14">
|
||||
<label class="cbi-value-title"><%:MPTCP over VPN%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="multipathvpn.<%=ifname%>.enabled" value="1" <% if uci:get("openmptcprouter",ifname,"multipathvpn") == "1" then %>checked<% end %> />
|
||||
|
|
@ -415,7 +766,7 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="7">
|
||||
<div class="cbi-value" data-index="15">
|
||||
<label class="cbi-value-title"><%:Enable SQM%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == "1" then %>checked<% end %> />
|
||||
|
|
@ -425,7 +776,7 @@ end
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="8">
|
||||
<div class="cbi-value" data-index="16">
|
||||
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
|
||||
|
|
@ -441,7 +792,7 @@ end
|
|||
-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="9">
|
||||
<div class="cbi-value" data-index="17">
|
||||
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
|
||||
|
|
@ -467,7 +818,7 @@ end
|
|||
<select class="cbi-section-create-name" name="add_interface_ifname">
|
||||
<%
|
||||
for _, ifacea in ipairs(ifaces) do
|
||||
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*")) and device_notvirtual(ifacea) then
|
||||
if not (ifacea == "lo" or ifacea == "6in4-omr6in4" or ifacea == "mlvpn0" or ifacea:match("^ifb.*") or ifacea:match("^sit.*") or ifacea:match("^gre.*") or ifacea:match("^ip6.*") or ifacea:match("^teql.*") or ifacea:match("^erspan.*")) then
|
||||
%>
|
||||
<option value="<%=ifacea%>"><%=ifacea%></option>
|
||||
<%
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
1113
luci-app-openmptcprouter/po/it/openmptcprouter.po
Normal file
1113
luci-app-openmptcprouter/po/it/openmptcprouter.po
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
|
||||
[ "$ACTION" = "add" ] || exit
|
||||
[ "$ACTION" = "add" ] || [ "$ACTION" = "bind" ] || exit
|
||||
[ -n "${INTERFACE}" ] || exit
|
||||
[ -n "${DEVPATH}" ] || exit
|
||||
|
||||
|
|
@ -12,14 +12,46 @@ _set_intf_name() {
|
|||
local device
|
||||
local ifname
|
||||
config_get device $intfname device
|
||||
config_get modalias $intfname modalias
|
||||
config_get ifname $intfname ifname
|
||||
[ -n "$device" ] && [ -n "$ifname" ] && [ "/sys${DEVPATH}" = "$device" ] && [ "$INTERFACE" != "$ifname" ] && {
|
||||
[ -n "$modalias" ] && {
|
||||
if [ -f /sys/class/net/${INTERFACE}/device/uevent ]; then
|
||||
#chk_modalias="$(cat /sys/class/net/${INTERFACE}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
|
||||
chk_modalias=$MODALIAS
|
||||
logger -t "OMR-Rename" "dir: $i - modalias: $modalias - chk_modalias: $chk_modalias - ifname: $ifname - INTERFACE: $INTERFACE"
|
||||
if [ "$modalias" = "$chk_modalias" ] && [ "$INTERFACE" != "$ifname" ]; then
|
||||
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
|
||||
existif=0
|
||||
ip link set ${INTERFACE} down
|
||||
[ "$(ip link show ${ifname} 2>/dev/null)" != "" ] && {
|
||||
ip link set ${ifname} name ${ifname}tmp
|
||||
existif=1
|
||||
}
|
||||
ip link set ${INTERFACE} name ${ifname}
|
||||
ip link set ${ifname} up
|
||||
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE}
|
||||
fi
|
||||
elif [ -f /dev/${DEVICE_NAME} ] && [ "$modalias" = "$MODALIAS" ]; then
|
||||
if [ "$device" != "/dev/${DEVICE_NAME}" ]; then
|
||||
ln -s /dev/${DEVICE_NAME} /dev/$intfname
|
||||
uci -q set network.${intfname}.device="/dev/${intfname}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
[ -z "$modalias" ] && [ -n "$device" ] && [ -n "$ifname" ] && [ "/sys${DEVPATH}" = "$device" ] && [ "$INTERFACE" != "$ifname" ] && {
|
||||
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
|
||||
ip link set ${INTERFACE} down
|
||||
existif=0
|
||||
[ "$(ip link show ${ifname} 2>/dev/null)" != "" ] && {
|
||||
ip link set ${ifname} name ${ifname}tmp
|
||||
existif=1
|
||||
}
|
||||
ip link set ${INTERFACE} name ${ifname}
|
||||
ip link set ${ifname} up
|
||||
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE}
|
||||
}
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach _set_intf_name interface
|
||||
config_foreach _set_intf_name interface
|
||||
|
|
|
|||
|
|
@ -21,12 +21,41 @@ omr_intf_set() {
|
|||
local multipath
|
||||
config_get multipath "$1" multipath
|
||||
config_get ifname "$1" ifname
|
||||
config_get device "$1" device
|
||||
config_get proto "$1" proto
|
||||
config_get type "$1" type
|
||||
config_get addlatency "$1" addlatency
|
||||
[ -z "$addlatency" ] && addlatency=0
|
||||
devicename=$(echo "$device" | cut -d'/' -f3)
|
||||
|
||||
[ -n "$ifname" ] && [ -L /sys/class/net/${ifname} ] && ([ "$proto" = "static" ] || [ "$proto" = "dhcp" ]) && {
|
||||
device=$(readlink -f /sys/class/net/${ifname})
|
||||
[ "$(echo ${device} | grep virtual)" = "" ] && uci -q set network.$1.device="$device"
|
||||
}
|
||||
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
|
||||
|
||||
if [ -n "$ifname" ]; then
|
||||
if [ "$addlatency" = "0" ] && [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
|
||||
tc qdisc del dev ${ifname} root netem
|
||||
fi
|
||||
if [ "$addlatency" != "0" ]; then
|
||||
if [ "$(tc qdisc show dev $ifname | grep delay)" != "" ]; then
|
||||
tc qdisc add dev ${ifname} root netem delay ${addlatency}ms
|
||||
elif [ "$(tc qdisc show dev $ifname | awk '/delay/ { print $10 }' | sed 's/ms//')" != "$addlatency" ]; then
|
||||
tc qdisc replace dev ${ifname} root netem delay ${addlatency}ms
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then
|
||||
devicepath=$(readlink -f /sys/class/net/${ifname})
|
||||
if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ]; then
|
||||
uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
|
||||
uci -q set network.$1.product="$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')"
|
||||
elif [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" != "" ]; then
|
||||
uci -q delete network.$1.device
|
||||
uci -q delete network.$1.modalias
|
||||
fi
|
||||
elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then
|
||||
uci -q set network.$1.modalias="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')"
|
||||
uci -q set network.$1.product="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')"
|
||||
fi
|
||||
|
||||
[ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "omrvpn" ] && [ "$1" != "glorytun" ] && return
|
||||
|
||||
|
|
@ -41,7 +70,7 @@ omr_intf_set() {
|
|||
}
|
||||
|
||||
start_service() {
|
||||
local scaling_min_freq scaling_max_freq
|
||||
local scaling_min_freq scaling_max_freq scaling_governor
|
||||
|
||||
config_load openmptcprouter
|
||||
config_foreach omr_intf_check interface
|
||||
|
|
@ -72,8 +101,8 @@ start_service() {
|
|||
}
|
||||
}
|
||||
# remove sysctl already defined in /etc/sysctl.d/
|
||||
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' -e '/tcp_retries2/d' /etc/sysctl.conf
|
||||
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' -e '/tcp_retries2/d' /etc/sysctl.d/10-default.conf
|
||||
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' -e '/tcp_retries2/d' -e '/tcp_retries1/d' -e '/ip_default_ttl/d' /etc/sysctl.conf
|
||||
sed -i -e '/tcp_fin_timeout/d' -e '/tcp_keepalive_time/d' -e '/nf_conntrack_max/d' -e '/tcp_syn_retries/d' -e '/tcp_fastopen/d' -e '/tcp_retries2/d' -e '/tcp_retries1/d' -e '/ip_default_ttl/d' /etc/sysctl.d/10-default.conf
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ net.ipv4.tcp_keepalive_time=7200
|
|||
net.ipv6.conf.all.disable_ipv6=0
|
||||
net.ipv4.tcp_fin_timeout=60
|
||||
net.ipv4.tcp_syn_retries=3
|
||||
net.ipv4.tcp_retries2=3
|
||||
net.ipv4.tcp_retries1=3
|
||||
net.ipv4.tcp_retries2=15
|
||||
net.ipv4.tcp_fastopen=3
|
||||
net.ipv4.tcp_low_latency=1
|
||||
net.ipv4.ip_default_ttl=64
|
||||
|
|
|
|||
|
|
@ -107,4 +107,7 @@ if [ "$(uci -q get openmptcprouter.settings.scaling_governor)" = "" ]; then
|
|||
commit openmptcprouter
|
||||
EOF
|
||||
fi
|
||||
|
||||
sed -i 's/net.ipv4.tcp_retries2=3$/net.ipv4.tcp_retries2=15/' /etc/sysctl.d/zzz_openmptcprouter.conf
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -706,6 +706,9 @@ function interfaces_status()
|
|||
end
|
||||
end
|
||||
end
|
||||
if mArray.openmptcprouter["service_addr"] ~= "" then
|
||||
mArray.openmptcprouter["service_addr_ip"] = ut.trim(sys.exec("resolveip -4 -t 1 " .. mArray.openmptcprouter["service_addr"] .. " | head -n 1"))
|
||||
end
|
||||
end
|
||||
|
||||
if mArray.openmptcprouter["service_addr"] ~= "" and mArray.openmptcprouter["service_addr"] ~= "127.0.0.1" then
|
||||
|
|
@ -784,6 +787,17 @@ function interfaces_status()
|
|||
else
|
||||
mArray.openmptcprouter["ss_traffic"] = "0"
|
||||
end
|
||||
if status and vpsinfo.v2ray ~= nil then
|
||||
mArray.openmptcprouter["v2ray_traffic_rx"] = vpsinfo.v2ray.rx or "0"
|
||||
mArray.openmptcprouter["v2ray_traffic_tx"] = vpsinfo.v2ray.tx or "0"
|
||||
mArray.openmptcprouter["v2ray_traffic"] = mArray.openmptcprouter["v2ray_traffic_tx"] + mArray.openmptcprouter["v2ray_traffic_rx"]
|
||||
else
|
||||
mArray.openmptcprouter["v2ray_traffic_rx"] = "0"
|
||||
mArray.openmptcprouter["v2ray_traffic_tx"] = "0"
|
||||
mArray.openmptcprouter["v2ray_traffic"] = "0"
|
||||
end
|
||||
mArray.openmptcprouter["proxy_traffic"] = mArray.openmptcprouter["ss_traffic"] + mArray.openmptcprouter["v2ray_traffic"]
|
||||
mArray.openmptcprouter["total_traffic"] = mArray.openmptcprouter["proxy_traffic"] + mArray.openmptcprouter["vpn_traffic"]
|
||||
else
|
||||
mArray.openmptcprouter["vps_admin"] = false
|
||||
mArray.openmptcprouter["vps_admin_error_msg"] = "No result"
|
||||
|
|
@ -870,22 +884,32 @@ function interfaces_status()
|
|||
end
|
||||
|
||||
-- check Shadowsocks is running
|
||||
mArray.openmptcprouter["socks_service"] = false
|
||||
mArray.openmptcprouter["shadowsocks_service"] = false
|
||||
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then
|
||||
mArray.openmptcprouter["socks_service"] = true
|
||||
mArray.openmptcprouter["shadowsocks_service"] = true
|
||||
end
|
||||
|
||||
mArray.openmptcprouter["socks_service_enabled"] = true
|
||||
mArray.openmptcprouter["shadowsocks_enabled"] = true
|
||||
local ss_server = uci:get("shadowsocks-libev","sss0","disabled") or "0"
|
||||
if ss_server == "1" then
|
||||
mArray.openmptcprouter["socks_service_enabled"] = false
|
||||
mArray.openmptcprouter["shadowsocks_enabled"] = false
|
||||
end
|
||||
-- check V2Ray is running
|
||||
mArray.openmptcprouter["v2ray_service"] = false
|
||||
if string.find(sys.exec("/usr/bin/pgrep v2ray"), "%d+") then
|
||||
mArray.openmptcprouter["v2ray_service"] = true
|
||||
end
|
||||
mArray.openmptcprouter["v2ray_enabled"] = false
|
||||
local v2ray = uci:get("v2ray","main","enabled") or "0"
|
||||
if v2ray == "1" then
|
||||
mArray.openmptcprouter["v2ray_enabled"] = true
|
||||
end
|
||||
local ss_key = uci:get("shadowsocks-libev","sss0","key") or ""
|
||||
mArray.openmptcprouter["socks_service_method"] = uci:get("shadowsocks-libev","sss0","method")
|
||||
mArray.openmptcprouter["shadowsocks_service_method"] = uci:get("shadowsocks-libev","sss0","method")
|
||||
if ss_key == "" then
|
||||
mArray.openmptcprouter["socks_service_key"] = false
|
||||
mArray.openmptcprouter["shadowsocks_service_key"] = false
|
||||
else
|
||||
mArray.openmptcprouter["socks_service_key"] = true
|
||||
mArray.openmptcprouter["shadowsocks_service_key"] = true
|
||||
end
|
||||
|
||||
-- Add DHCP infos by parsing dnsmasq config file
|
||||
|
|
@ -1174,12 +1198,12 @@ function interfaces_status()
|
|||
if connectivity ~= "ERROR" then
|
||||
if ifname ~= nil and ifname:match("^tun.*") and interface:match("^ovpn.*") then
|
||||
publicIP = uci:get("openmptcprouter",interface:sub(5),"publicip") or ""
|
||||
if ifname ~= nil and publicIP == "" and mArray.openmptcprouter["external_check"] ~= false then
|
||||
if ifname ~= nil and publicIP == "" and mArray.openmptcprouter["external_check"] ~= false and mArray.openmptcprouter["dns"] == true then
|
||||
publicIP = ut.trim(sys.exec("omr-ip-intf " .. get_device(interface:sub(5))))
|
||||
end
|
||||
else
|
||||
publicIP = uci:get("openmptcprouter",interface,"publicip") or ""
|
||||
if ifname ~= nil and publicIP == "" and mArray.openmptcprouter["external_check"] ~= false then
|
||||
if ifname ~= nil and publicIP == "" and mArray.openmptcprouter["external_check"] ~= false and mArray.openmptcprouter["dns"] == true then
|
||||
publicIP = ut.trim(sys.exec("omr-ip-intf " .. ifname))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue