1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan168 2022-05-20 08:25:55 +08:00
parent 3c8e2f60b0
commit 9916032c7a
185 changed files with 4014 additions and 7755 deletions

View file

@ -21,6 +21,5 @@ uci show | \
-e "/vpn\.key=/s/......$/xxxxxx'/" \
-e "/vps\.key=/s/......$/xxxxxx'/" \
-e "/wgkey=/s/......$/xxxxxx'/" \
-e "/key=/s/......$/xxxxxx'/" \
-e "/ula_prefix=2/s/=.........../='xxxxxxxxxxx/" \
-e "/token=/s/............$/xxxxxx'/"

View file

@ -10,7 +10,7 @@ timeout 1 mmcli -L | while read MODEM; do
OPERATOR=$(echo "$MODEM_INFO" | grep 'modem.3gpp.operator-name ' | awk -F": " '{print $2}')
NUMBER=$(echo "$MODEM_INFO" | grep 'modem.generic.own-numbders.value[1]' | awk -F": " '{print $2}')
STATE=$(echo "$MODEM_INFO" | grep 'modem.generic.state ' | awk -F": " '{print $2}')
TYPE=$(echo "$MODEM_INFO" | grep 'modem.generic.access-technologies.value\[1\]' | awk -F": " '{print $2}')
TYPE=$(echo "$MODEM_INFO" | grep 'modem.generic.access-technologies.values[1]' | awk -F": " '{print $2}')
[ -z "$INFO" ] && echo $PERCENT
[ "$INFO" = "all" ] && echo "$PERCENT;$OPERATOR;$NUMBER;$STATE;$TYPE"
exit

View file

@ -12,17 +12,9 @@ get_mptcp_from_server() {
get_mptcp() {
serverip=$1
if [ "$(echo $serverip | grep :)" ]; then
if [ -f /proc/sys/net/mptcp/enabled ]; then
support="$(mptcpize run curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
else
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
fi
support="$(curl -s -k -6 -m ${timeout} --interface $intf https://[$serverip]:$serverport/mptcpsupport)"
else
if [ -f /proc/sys/net/mptcp/enabled ]; then
support="$(mptcpize run curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
else
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
fi
support="$(curl -s -k -4 -m ${timeout} --interface $intf https://$serverip:$serverport/mptcpsupport)"
fi
[ -n "$support" ] && {
support=$(echo $support | jsonfilter -e '@.mptcp')
@ -64,10 +56,8 @@ get_mptcp_from_website6() {
support=""
config_load openmptcprouter
config_foreach get_mptcp_from_server server
if [ ! -f /proc/sys/net/mptcp/enabled ] && [ -z "$support" ]; then
[ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
[ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
fi
[ -z "$support" ] && [ -n "$(ip -4 a show dev $intf)" ] && get_mptcp_from_website
[ -z "$support" ] && [ -n "$(ip -6 a show dev $intf)" ] && get_mptcp_from_website6
if [ "$support" = "working" ]; then
echo "MPTCP enabled"
elif [ "$support" = "not working" ]; then

View file

View file

@ -6,8 +6,6 @@ START=5
USE_PROCD=1
. /lib/functions/network.sh
omr_intf_del() {
[ -z "$1" ] && return
uci -q delete openmptcprouter.$1
@ -20,15 +18,12 @@ omr_intf_check() {
omr_intf_set() {
local device
local ifname
network_get_device ifname $1
[ -z "$ifname" ] && network_get_physdev ifname $1
[ -z "$ifname" ] && config_get ifname "$1" device
[ -z "$ifname" ] && config_get ifname "$1" ifname
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
#config_get devicename "$1" _modem_device
devicename=${ifname}
config_get ifname "$1" ifname
config_get device "$1" device
config_get type "$1" type
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
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)" = "" ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PCI_SLOT_NAME)" = "" ]; then
@ -39,11 +34,11 @@ omr_intf_set() {
uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')-$mac"
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)" != "" ] || [ "$(echo ${devicepath} | grep virtual)" = "" ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" = "" ] || [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PCI_SLOT_NAME)" != "" ] || [ "$(cat /sys/class/net/${ifname}tmp/device/uevent)" != "" ]); then
#uci -q delete network.$1.device
uci -q delete network.$1.device
uci -q delete network.$1.modalias
uci -q delete network.$1.product
fi
elif [ "$type" != "macvlan" ] && [ -n "$devicename" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then
elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then
mac=""
if [ -f /sys/class/net/${ifname}/address ]; then
mac="$(cat /sys/class/net/${ifname}/address | tr -d '\n')"
@ -61,10 +56,7 @@ omr_set_settings() {
local ifname
local multipath
config_get multipath "$1" multipath
network_get_device ifname $1
[ -z "$ifname" ] && network_get_physdev ifname $1
[ -z "$ifname" ] && config_get ifname "$1" device
[ -z "$ifname" ] && config_get ifname "$1" ifname
config_get ifname "$1" ifname
config_get device "$1" device
config_get proto "$1" proto
config_get type "$1" type
@ -84,8 +76,7 @@ omr_set_settings() {
[ -z "$addlatency" ] && addlatency=0
devicename=$(echo "$device" | cut -d'/' -f3)
ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -z "$ifname" ] && config_get ifname "$1" ifname
[ -z "$ifname" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["l3_device"]')
[ -n "$(echo $ifname | grep '@')" ] && ifname=$(ifstatus "$1" | jsonfilter -q -e '@["device"]')
if [ -n "$ifname" ]; then
@ -153,13 +144,15 @@ start_service() {
del_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
add_list dhcp.@dnsmasq[0].server='114.114.114.114'
set dhcp.@dnsmasq[0].dnsseccheckunsigned='0'
delete dhcp.@dnsmasq[0].dnssec
delete dhcp.@dnsmasq[0].dnssec='1'
commit dhcp
EOF
elif [ "$(uci -q get openmptcprouter.settings.country)" = "world" ] && [ -n "$(uci -q get dhcp.@dnsmasq[0].server | grep '114.114.114.114')" ]; then
uci -q batch <<-EOF > /dev/null
add_list dhcp.@dnsmasq[0].server='127.0.0.1#5353'
del_list dhcp.@dnsmasq[0].server='114.114.114.114'
set dhcp.@dnsmasq[0].dnsseccheckunsigned='1'
set dhcp.@dnsmasq[0].dnssec='1'
commit dhcp
EOF
fi

View file

@ -11,7 +11,7 @@ local jsonc = require "luci.jsonc"
function interface_from_device(dev)
for _, iface in ipairs(net:get_networks()) do
local ifacen = iface:name()
local ifacename = ucic:get("network",ifacen,"device")
local ifacename = ucic:get("network",ifacen,"ifname")
if ifacename == dev then
return ifacen
end
@ -72,7 +72,7 @@ function add_interface(add_interface_ifname)
end
ucic:set("network","wan" .. i,"interface")
ucic:set("network","wan" .. i,"device",defif)
ucic:set("network","wan" .. i,"ifname",defif)
ucic:set("network","wan" .. i,"proto","static")
if ointf ~= "" then
ucic:set("network","wan" .. i,"type","macvlan")
@ -128,7 +128,7 @@ end
function remove_interface(intf)
-- Remove existing interface
local defif = ucic:get("network",intf,"device")
local defif = ucic:get("network",intf,"ifname")
ucic:delete("network",intf)
ucic:delete("network",intf .. "_dev")
ucic:save("network")
@ -170,7 +170,7 @@ function set_interface(intf,proto,ipaddr,netmask,gateway,sqmenabled,downloadspee
if not ucic:get("sqm",intf) ~= "" then
local defif = get_device(intf)
if defif == "" then
defif = ucic:get("network",intf,"device") or ""
defif = ucic:get("network",intf,"ifname") or ""
end
ucic:set("sqm",intf,"queue")
ucic:set("sqm",intf,"interface",defif)
@ -268,7 +268,7 @@ function default_vpn(default_vpn)
ucic:set("network","omrvpn","proto","dhcp")
end
if vpn_intf ~= "" then
ucic:set("network","omrvpn","device",vpn_intf)
ucic:set("network","omrvpn","ifname",vpn_intf)
ucic:save("network")
ucic:commit("network")
end
@ -824,7 +824,7 @@ function interfaces_status()
if mArray.openmptcprouter["external_check"] ~= false then
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " " .. check_ipv4_website))
if mArray.openmptcprouter["proxy_addr"] == "" then
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " ifconfig.me"))
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " ifconfig.co"))
end
--mArray.openmptcprouter["ss_addr6"] = sys.exec("curl -s -6 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ipv6.openmptcprouter.com")
end
@ -931,11 +931,6 @@ function interfaces_status()
else
mArray.openmptcprouter["vps_admin"] = false
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
else
mArray.openmptcprouter["vps_admin"] = false
@ -966,10 +961,7 @@ function interfaces_status()
if string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?glorytun(-udp)?$'"), "%d+") or string.find(sys.exec("/usr/bin/pgrep '^(/usr/sbin/)?dsvpn?$'"), "%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_ip"] = get_ip("omrvpn")
local tun_dev = uci:get("network","omrvpn","device")
if tun_dev == "" then
tun_dev = uci:get("network","omrvpn","ifname")
end
local tun_dev = uci:get("network","omrvpn","ifname")
if tun_dev == "" then
tun_dev = get_device("omrvpn")
end
@ -1027,7 +1019,7 @@ function interfaces_status()
mArray.openmptcprouter["multi_vpn"] = true
end
end
-- check Shadowsocks is running
mArray.openmptcprouter["shadowsocks_service"] = false
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then
@ -1035,16 +1027,10 @@ function interfaces_status()
end
mArray.openmptcprouter["shadowsocks_enabled"] = true
local ss_server = "1"
ucic:foreach("shadowsocks-libev", "server", function(s)
if uci:get("shadowsocks-libev",s[".name"],"disabled") == "0" then
ss_server = "0"
end
end)
local ss_server = uci:get("shadowsocks-libev","sss0","disabled") or "0"
if ss_server == "1" then
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
@ -1153,14 +1139,14 @@ function interfaces_status()
local ifname = get_device(interface)
if ifname == "" or ifname == nil then
ifname = section["device"] or ""
ifname = section["ifname"] or ""
end
--if ifname ~= nil and ifname:match("^tun.*") and interface:match("^ovpn.*") then
--ifname = get_device(interface:sub(5))
--end
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["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
if allintf[ifname] then
connectivity = "ERROR"
duplicateif = true
@ -1170,7 +1156,7 @@ function interfaces_status()
end
duplicatemac = false
if mac ~= "" and mac ~= nil and not (section["device"] ~= nil and section["device"]:match("^@.*")) and not (ifname ~= nil and ifname:match("%.")) then
if mac ~= "" and mac ~= nil and not (section["ifname"] ~= nil and section["ifname"]:match("^@.*")) then
if allmac[mac] then
connectivity = "ERROR"
duplicatemac = true
@ -1385,8 +1371,7 @@ function interfaces_status()
if adminport == "" then
adminport = "65500"
end
-- httping disable for now, with -l (ssl) timeout is ignored
if false and server_ping == "UP" and uci:get("openmptcprouter", "settings", "disableserverhttptest") ~= "1" and ipaddr ~= "" and adminport ~= "" then
if server_ping == "UP" and uci:get("openmptcprouter", "settings", "disableserverhttptest") ~= "1" and ipaddr ~= "" and adminport ~= "" then
local server_http_result = ""
local server_http_test = ""
if mArray.openmptcprouter["service_addr_ip"] ~= "" then