mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 02:51:50 +00:00
Use double quotes everywhere, instead of both
This commit is contained in:
parent
7fcf5b43f5
commit
32a67a1756
1 changed files with 47 additions and 47 deletions
|
@ -470,7 +470,7 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
-- wanaddr
|
-- wanaddr
|
||||||
mArray.openmptcprouter["wan_addr"] = sys.exec("wget -4 -qO- -T 1 http://ip.openmptcprouter.com")
|
mArray.openmptcprouter["wan_addr"] = sys.exec("wget -4 -qO- -T 1 http://ip.openmptcprouter.com")
|
||||||
if mArray.openmptcprouter["ipv6"] == 'enabled' then
|
if mArray.openmptcprouter["ipv6"] == "enabled" then
|
||||||
mArray.openmptcprouter["wan_addr6"] = sys.exec("wget -6 -qO- -T 1 http://ipv6.openmptcprouter.com")
|
mArray.openmptcprouter["wan_addr6"] = sys.exec("wget -6 -qO- -T 1 http://ipv6.openmptcprouter.com")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -487,8 +487,8 @@ function interfaces_status()
|
||||||
|
|
||||||
-- Check openmptcprouter service are running
|
-- Check openmptcprouter service are running
|
||||||
mArray.openmptcprouter["tun_service"] = false
|
mArray.openmptcprouter["tun_service"] = false
|
||||||
mArray.openmptcprouter["tun_state"] = ''
|
mArray.openmptcprouter["tun_state"] = ""
|
||||||
mArray.openmptcprouter["tun6_state"] = ''
|
mArray.openmptcprouter["tun6_state"] = ""
|
||||||
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?mlvpn?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?openvpn?$'"), "%d+") then
|
||||||
mArray.openmptcprouter["tun_service"] = true
|
mArray.openmptcprouter["tun_service"] = true
|
||||||
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
mArray.openmptcprouter["tun_ip"] = get_ip("omrvpn")
|
||||||
|
@ -504,21 +504,21 @@ function interfaces_status()
|
||||||
if peer ~= "" then
|
if peer ~= "" then
|
||||||
local tunnel_ping_test = ut.trim(sys.exec("ping -W 1 -c 1 " .. peer .. " -I " .. tun_dev .. " | grep '100% packet loss'"))
|
local tunnel_ping_test = ut.trim(sys.exec("ping -W 1 -c 1 " .. peer .. " -I " .. tun_dev .. " | grep '100% packet loss'"))
|
||||||
if tunnel_ping_test == "" then
|
if tunnel_ping_test == "" then
|
||||||
mArray.openmptcprouter["tun_state"] = 'UP'
|
mArray.openmptcprouter["tun_state"] = "UP"
|
||||||
else
|
else
|
||||||
mArray.openmptcprouter["tun_state"] = 'DOWN'
|
mArray.openmptcprouter["tun_state"] = "DOWN"
|
||||||
end
|
end
|
||||||
if mArray.openmptcprouter["ipv6"] == 'enabled' then
|
if mArray.openmptcprouter["ipv6"] == "enabled" then
|
||||||
local tunnel_ping6_test = ut.trim(sys.exec("ping6 -W 1 -c 1 fe80::a00:1 -I 6in4-omr6in4 | grep '100% packet loss'"))
|
local tunnel_ping6_test = ut.trim(sys.exec("ping6 -W 1 -c 1 fe80::a00:1 -I 6in4-omr6in4 | grep '100% packet loss'"))
|
||||||
if tunnel_ping6_test == "" then
|
if tunnel_ping6_test == "" then
|
||||||
mArray.openmptcprouter["tun6_state"] = 'UP'
|
mArray.openmptcprouter["tun6_state"] = "UP"
|
||||||
else
|
else
|
||||||
mArray.openmptcprouter["tun6_state"] = 'DOWN'
|
mArray.openmptcprouter["tun6_state"] = "DOWN"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
mArray.openmptcprouter["tun_state"] = 'DOWN'
|
mArray.openmptcprouter["tun_state"] = "DOWN"
|
||||||
mArray.openmptcprouter["tun6_state"] = 'DOWN'
|
mArray.openmptcprouter["tun6_state"] = "DOWN"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -583,15 +583,15 @@ function interfaces_status()
|
||||||
local interface = section[".name"]
|
local interface = section[".name"]
|
||||||
local net = ntm:get_network(interface)
|
local net = ntm:get_network(interface)
|
||||||
local ipaddr = net:ipaddr()
|
local ipaddr = net:ipaddr()
|
||||||
local gateway = section['gateway'] or ""
|
local gateway = section["gateway"] or ""
|
||||||
local multipath = section['multipath']
|
local multipath = section["multipath"]
|
||||||
local enabled = section['auto']
|
local enabled = section["auto"]
|
||||||
|
|
||||||
--if not ipaddr or not gateway then return end
|
--if not ipaddr or not gateway then return end
|
||||||
-- Don't show if0 in the overview
|
-- Don't show if0 in the overview
|
||||||
--if interface == "lo" then return end
|
--if interface == "lo" then return end
|
||||||
|
|
||||||
local ifname = section['ifname'] or ""
|
local ifname = section["ifname"] or ""
|
||||||
if ifname == "" then
|
if ifname == "" then
|
||||||
ifname = get_device(interface)
|
ifname = get_device(interface)
|
||||||
end
|
end
|
||||||
|
@ -607,23 +607,23 @@ function interfaces_status()
|
||||||
if fs.access("/sys/class/net/" .. ifname) then
|
if fs.access("/sys/class/net/" .. ifname) then
|
||||||
local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated"))
|
local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated"))
|
||||||
if multipath_state == "" then
|
if multipath_state == "" then
|
||||||
connectivity = 'OK'
|
connectivity = "OK"
|
||||||
else
|
else
|
||||||
connectivity = 'ERROR'
|
connectivity = "ERROR"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
connectivity = 'ERROR'
|
connectivity = "ERROR"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
connectivity = 'ERROR'
|
connectivity = "ERROR"
|
||||||
end
|
end
|
||||||
|
|
||||||
if ipaddr == "" then
|
if ipaddr == "" then
|
||||||
connectivity = 'ERROR'
|
connectivity = "ERROR"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Detect WAN gateway status
|
-- Detect WAN gateway status
|
||||||
local gw_ping = 'UP'
|
local gw_ping = "UP"
|
||||||
if gateway == "" then
|
if gateway == "" then
|
||||||
gateway = get_gateway(interface)
|
gateway = get_gateway(interface)
|
||||||
end
|
end
|
||||||
|
@ -635,28 +635,28 @@ function interfaces_status()
|
||||||
if connectivity ~= "ERROR" and gateway ~= "" then
|
if connectivity ~= "ERROR" and gateway ~= "" then
|
||||||
local gw_ping_test = ut.trim(sys.exec("ping -W 1 -c 1 " .. gateway .. " | grep '100% packet loss'"))
|
local gw_ping_test = ut.trim(sys.exec("ping -W 1 -c 1 " .. gateway .. " | grep '100% packet loss'"))
|
||||||
if gw_ping_test ~= "" then
|
if gw_ping_test ~= "" then
|
||||||
gw_ping = 'DOWN'
|
gw_ping = "DOWN"
|
||||||
if connectivity == "OK" then
|
if connectivity == "OK" then
|
||||||
connectivity = 'WARNING'
|
connectivity = "WARNING"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
gw_ping = 'DOWN'
|
gw_ping = "DOWN"
|
||||||
connectivity = 'ERROR'
|
connectivity = "ERROR"
|
||||||
end
|
end
|
||||||
|
|
||||||
local latency = ""
|
local latency = ""
|
||||||
local server_ping = ''
|
local server_ping = ""
|
||||||
if connectivity ~= "ERROR" and ifname ~= "" and gateway ~= "" and gw_ping ~= "DOWN" and ifname ~= nil and mArray.openmptcprouter["service_addr"] ~= "" then
|
if connectivity ~= "ERROR" and ifname ~= "" and gateway ~= "" and gw_ping ~= "DOWN" and ifname ~= nil and mArray.openmptcprouter["service_addr"] ~= "" then
|
||||||
local server_ping_test = sys.exec("ping -W 1 -c 1 -I " .. ifname .. " " .. mArray.openmptcprouter["service_addr"])
|
local server_ping_test = sys.exec("ping -W 1 -c 1 -I " .. ifname .. " " .. mArray.openmptcprouter["service_addr"])
|
||||||
local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'"))
|
local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'"))
|
||||||
if server_ping_result ~= "" then
|
if server_ping_result ~= "" then
|
||||||
server_ping = 'DOWN'
|
server_ping = "DOWN"
|
||||||
if connectivity == "OK" then
|
if connectivity == "OK" then
|
||||||
connectivity = 'WARNING'
|
connectivity = "WARNING"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
server_ping = 'UP'
|
server_ping = "UP"
|
||||||
latency = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | cut -d '/' -s -f4 | cut -d '.' -f1"))
|
latency = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | cut -d '/' -s -f4 | cut -d '.' -f1"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -671,7 +671,7 @@ function interfaces_status()
|
||||||
multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'you are MPTCP-capable'"))
|
multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'you are MPTCP-capable'"))
|
||||||
end
|
end
|
||||||
if multipath_available_state ~= "" then
|
if multipath_available_state ~= "" then
|
||||||
multipath_available = 'OK'
|
multipath_available = "OK"
|
||||||
else
|
else
|
||||||
if mArray.openmptcprouter["service_addr"] ~= "" then
|
if mArray.openmptcprouter["service_addr"] ~= "" then
|
||||||
multipath_available_state_wan = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
|
multipath_available_state_wan = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
|
||||||
|
@ -679,46 +679,46 @@ function interfaces_status()
|
||||||
multipath_available_state_wan = "none"
|
multipath_available_state_wan = "none"
|
||||||
end
|
end
|
||||||
if multipath_available_state_wan == "" then
|
if multipath_available_state_wan == "" then
|
||||||
multipath_available = 'OK'
|
multipath_available = "OK"
|
||||||
mArray.openmptcprouter["server_mptcp"] = "disabled"
|
mArray.openmptcprouter["server_mptcp"] = "disabled"
|
||||||
else
|
else
|
||||||
multipath_available = 'ERROR'
|
multipath_available = "ERROR"
|
||||||
if mArray.openmptcprouter["socks_service"] == true and connectivity == "OK" then
|
if mArray.openmptcprouter["socks_service"] == true and connectivity == "OK" then
|
||||||
connectivity = 'ERROR'
|
connectivity = "ERROR"
|
||||||
elseif connectivity == "OK" then
|
elseif connectivity == "OK" then
|
||||||
connectivity = 'WARNING'
|
connectivity = "WARNING"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
multipath_available = 'NO CHECK'
|
multipath_available = "NO CHECK"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Detect if WAN get an IPv6
|
-- Detect if WAN get an IPv6
|
||||||
local ipv6_discover = 'NONE'
|
local ipv6_discover = "NONE"
|
||||||
if ifname ~= nil then
|
if ifname ~= nil then
|
||||||
if mArray.openmptcprouter["ipv6"] == 'enabled' then
|
if mArray.openmptcprouter["ipv6"] == "enabled" then
|
||||||
local ipv6_result = _ipv6_discover(ifname)
|
local ipv6_result = _ipv6_discover(ifname)
|
||||||
if type(ipv6_result) == "table" and #ipv6_result > 0 then
|
if type(ipv6_result) == "table" and #ipv6_result > 0 then
|
||||||
local ipv6_addr_test
|
local ipv6_addr_test
|
||||||
for k,v in ipairs(ipv6_result) do
|
for k,v in ipairs(ipv6_result) do
|
||||||
if v.RecursiveDnsServer then
|
if v.RecursiveDnsServer then
|
||||||
if type(v.RecursiveDnsServer) ~= "table" then
|
if type(v.RecursiveDnsServer) ~= "table" then
|
||||||
ipv6_addr_test = sys.exec('ip -6 addr | grep ' .. v.RecursiveDnsServer)
|
ipv6_addr_test = sys.exec("ip -6 addr | grep " .. v.RecursiveDnsServer)
|
||||||
if ipv6_addr_test == "" then
|
if ipv6_addr_test == "" then
|
||||||
ipv6_discover = 'DETECTED'
|
ipv6_discover = "DETECTED"
|
||||||
if connectivity == "OK" then
|
if connectivity == "OK" then
|
||||||
connectivity = 'WARNING'
|
connectivity = "WARNING"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for i,j in ipairs(ipv6_result) do
|
for i,j in ipairs(ipv6_result) do
|
||||||
ipv6_addr_test = sys.exec('ip -6 addr | grep ' .. j)
|
ipv6_addr_test = sys.exec("ip -6 addr | grep " .. j)
|
||||||
if ipv6_addr_test == "" then
|
if ipv6_addr_test == "" then
|
||||||
ipv6_discover = 'DETECTED'
|
ipv6_discover = "DETECTED"
|
||||||
if connectivity == "OK" then
|
if connectivity == "OK" then
|
||||||
connectivity = 'WARNING'
|
connectivity = "WARNING"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -736,20 +736,20 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
label = section['label'] or interface,
|
label = section["label"] or interface,
|
||||||
name = interface,
|
name = interface,
|
||||||
link = net:adminlink(),
|
link = net:adminlink(),
|
||||||
ifname = ifname,
|
ifname = ifname,
|
||||||
ipaddr = ipaddr,
|
ipaddr = ipaddr,
|
||||||
gateway = gateway,
|
gateway = gateway,
|
||||||
multipath = section['multipath'],
|
multipath = section["multipath"],
|
||||||
status = connectivity,
|
status = connectivity,
|
||||||
wanip = publicIP,
|
wanip = publicIP,
|
||||||
latency = latency,
|
latency = latency,
|
||||||
whois = whois or "unknown",
|
whois = whois or "unknown",
|
||||||
qos = section['trafficcontrol'],
|
qos = section["trafficcontrol"],
|
||||||
download = section['download'],
|
download = section["download"],
|
||||||
upload = section['upload'],
|
upload = section["upload"],
|
||||||
gw_ping = gw_ping,
|
gw_ping = gw_ping,
|
||||||
server_ping = server_ping,
|
server_ping = server_ping,
|
||||||
ipv6_discover = ipv6_discover,
|
ipv6_discover = ipv6_discover,
|
||||||
|
|
Loading…
Reference in a new issue