mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
parent
25e1b7e68f
commit
60a6017a93
2 changed files with 13 additions and 32 deletions
|
@ -1484,14 +1484,20 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if publicIP ~= "" then
|
if publicIP ~= "" then
|
||||||
whois = ut.trim(sys.exec("curl -4 --max-time 20 -s -k 'https://api.ip138.com/ip/?ip=" .. publicIP .. "&datatype=txt&callback=find' -H 'token:99eeff11df2c5c5a6e6b984bafd0bb77' | awk '{print $3 $4 $5 $6}'"))
|
whois = uci:get("openmptcprouter",interface,"asn") or ""
|
||||||
|
if whois == "" and mArray.openmptcprouter["external_check"] ~= false and mArray.openmptcprouter["dns"] == true then
|
||||||
|
whois = ut.trim(sys.exec("whois " .. publicIP .. " | grep -i 'netname' | awk '{print $2}'"))
|
||||||
|
--whois = ut.trim(sys.exec("wget -4 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP .. "' | jsonfilter -q -e '@.as_description'"))
|
||||||
end
|
end
|
||||||
if publicIP == mArray.openmptcprouter["wan_addr"] then
|
if publicIP == mArray.openmptcprouter["wan_addr"] then
|
||||||
mArray.openmptcprouter["direct_output"] = true
|
mArray.openmptcprouter["direct_output"] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if publicIP6 ~= "" then
|
if publicIP6 ~= "" then
|
||||||
whois6 = ut.trim(sys.exec("curl -6 --max-time 20 -s -k 'https://api.ip138.com/ip/?ip=" .. publicIP6 .. "&datatype=txt&callback=find' -H 'token:99eeff11df2c5c5a6e6b984bafd0bb77' | awk '{print $3 $4 $5 $6}'"))
|
whois6 = uci:get("openmptcprouter",interface,"asn") or ""
|
||||||
|
if whois6 == "" and mArray.openmptcprouter["external_check"] ~= false and mArray.openmptcprouter["dns"] == true then
|
||||||
|
whois6 = ut.trim(sys.exec("whois " .. publicIP6 .. " | grep -i 'netname' | awk '{print $2}'"))
|
||||||
|
--whois6 = ut.trim(sys.exec("wget -6 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP6 .. "' | jsonfilter -q -e '@.as_description'"))
|
||||||
end
|
end
|
||||||
if publicIP6 == mArray.openmptcprouter["wan_addr6"] then
|
if publicIP6 == mArray.openmptcprouter["wan_addr6"] then
|
||||||
mArray.openmptcprouter["direct_output"] = true
|
mArray.openmptcprouter["direct_output"] = true
|
||||||
|
|
|
@ -931,11 +931,6 @@ function interfaces_status()
|
||||||
else
|
else
|
||||||
mArray.openmptcprouter["vps_admin"] = false
|
mArray.openmptcprouter["vps_admin"] = false
|
||||||
mArray.openmptcprouter["vps_admin_error_msg"] = "No result"
|
mArray.openmptcprouter["vps_admin_error_msg"] = "No result"
|
||||||
uci:set("openmptcprouter",s[".name"],"admin_error","1")
|
|
||||||
mArray.openmptcprouter["vps_admin_error"] = true
|
|
||||||
uci:delete("openmptcprouter",s[".name"],"token")
|
|
||||||
uci:save("openmptcprouter",s[".name"])
|
|
||||||
uci:commit("openmptcprouter",s[".name"])
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
mArray.openmptcprouter["vps_admin"] = false
|
mArray.openmptcprouter["vps_admin"] = false
|
||||||
|
@ -1027,7 +1022,7 @@ function interfaces_status()
|
||||||
mArray.openmptcprouter["multi_vpn"] = true
|
mArray.openmptcprouter["multi_vpn"] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check Shadowsocks is running
|
-- check Shadowsocks is running
|
||||||
mArray.openmptcprouter["shadowsocks_service"] = false
|
mArray.openmptcprouter["shadowsocks_service"] = false
|
||||||
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then
|
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then
|
||||||
|
@ -1035,16 +1030,10 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
|
|
||||||
mArray.openmptcprouter["shadowsocks_enabled"] = true
|
mArray.openmptcprouter["shadowsocks_enabled"] = true
|
||||||
local ss_server = "1"
|
local ss_server = uci:get("shadowsocks-libev","sss0","disabled") or "0"
|
||||||
ucic:foreach("shadowsocks-libev", "server", function(s)
|
|
||||||
if uci:get("shadowsocks-libev",s[".name"],"disabled") == "0" then
|
|
||||||
ss_server = "0"
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
if ss_server == "1" then
|
if ss_server == "1" then
|
||||||
mArray.openmptcprouter["shadowsocks_enabled"] = false
|
mArray.openmptcprouter["shadowsocks_enabled"] = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check V2Ray is running
|
-- check V2Ray is running
|
||||||
mArray.openmptcprouter["v2ray_service"] = false
|
mArray.openmptcprouter["v2ray_service"] = false
|
||||||
if string.find(sys.exec("/usr/bin/pgrep v2ray"), "%d+") then
|
if string.find(sys.exec("/usr/bin/pgrep v2ray"), "%d+") then
|
||||||
|
@ -1160,7 +1149,7 @@ function interfaces_status()
|
||||||
--end
|
--end
|
||||||
|
|
||||||
duplicateif = false
|
duplicateif = false
|
||||||
if ifname ~= "" and ifname ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) and (proto == "static" or proto == "dhcp") then
|
if ifname ~= "" and ifname ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) then
|
||||||
if allintf[ifname] then
|
if allintf[ifname] then
|
||||||
connectivity = "ERROR"
|
connectivity = "ERROR"
|
||||||
duplicateif = true
|
duplicateif = true
|
||||||
|
@ -1484,24 +1473,10 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if publicIP ~= "" then
|
if publicIP ~= "" then
|
||||||
whois = uci:get("openmptcprouter",interface,"asn") or ""
|
whois = ut.trim(sys.exec("curl -4 --max-time 20 -s -k 'https://api.ip138.com/ip/?ip=" .. publicIP .. "&datatype=txt&callback=find' -H 'token:99eeff11df2c5c5a6e6b984bafd0bb77' | awk '{print $3 $4 $5 $6}'"))
|
||||||
if whois == "" and mArray.openmptcprouter["external_check"] ~= false and mArray.openmptcprouter["dns"] == true then
|
|
||||||
whois = ut.trim(sys.exec("whois " .. publicIP .. " | grep -i 'netname' | awk '{print $2}'"))
|
|
||||||
--whois = ut.trim(sys.exec("wget -4 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP .. "' | jsonfilter -q -e '@.as_description'"))
|
|
||||||
end
|
|
||||||
if publicIP == mArray.openmptcprouter["wan_addr"] then
|
|
||||||
mArray.openmptcprouter["direct_output"] = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if publicIP6 ~= "" then
|
if publicIP6 ~= "" then
|
||||||
whois6 = uci:get("openmptcprouter",interface,"asn") or ""
|
whois6 = ut.trim(sys.exec("curl -6 --max-time 20 -s -k 'https://api.ip138.com/ip/?ip=" .. publicIP6 .. "&datatype=txt&callback=find' -H 'token:99eeff11df2c5c5a6e6b984bafd0bb77' | awk '{print $3 $4 $5 $6}'"))
|
||||||
if whois6 == "" and mArray.openmptcprouter["external_check"] ~= false and mArray.openmptcprouter["dns"] == true then
|
|
||||||
whois6 = ut.trim(sys.exec("whois " .. publicIP6 .. " | grep -i 'netname' | awk '{print $2}'"))
|
|
||||||
--whois6 = ut.trim(sys.exec("wget -6 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP6 .. "' | jsonfilter -q -e '@.as_description'"))
|
|
||||||
end
|
|
||||||
if publicIP6 == mArray.openmptcprouter["wan_addr6"] then
|
|
||||||
mArray.openmptcprouter["direct_output"] = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if ifname ~= "" and ifname ~= nil then
|
if ifname ~= "" and ifname ~= nil then
|
||||||
if fs.access("/sys/class/net/" .. ifname) then
|
if fs.access("/sys/class/net/" .. ifname) then
|
Loading…
Add table
Add a link
Reference in a new issue