1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge branch 'test' into ipq60xx

This commit is contained in:
suyuan168 2022-06-03 16:15:48 +08:00
commit 123912e016
10 changed files with 49 additions and 29 deletions

View file

@ -153,7 +153,7 @@ _ping() {
"${host}" 2>&1
) && echo "$ret" | grep -sq "bytes from" && {
if [ "$localip" = "yes" ]; then
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1)
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
_update_rto "$OMR_TRACKER_LATENCY"
fi
return
@ -166,7 +166,7 @@ _ping() {
"${host}" 2>&1
) && echo "$ret" | grep -sq "bytes from" && {
if [ "$localip" = "yes" ]; then
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1)
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
_update_rto "$OMR_TRACKER_LATENCY"
fi
return
@ -392,7 +392,7 @@ while true; do
config_load openmptcprouter
config_foreach _httping_server server $OMR_TRACKER_DEVICE_IP
if [ "$serverip_ping" = false ]; then
OMR_TRACKER_STATUS="ERROR"
#OMR_TRACKER_STATUS="ERROR"
OMR_TRACKER_STATUS_MSG="No access to server API"
else
OMR_TRACKER_STATUS_MSG=""
@ -493,7 +493,7 @@ while true; do
config_foreach _httping_server server $OMR_TRACKER_DEVICE_IP
if [ "$serverip_ping" = false ]; then
OMR_TRACKER_STATUS_MSG="No access to server API"
OMR_TRACKER_STATUS="ERROR"
#OMR_TRACKER_STATUS="ERROR"
else
OMR_TRACKER_STATUS_MSG=""
OMR_TRACKER_STATUS="OK"

View file

@ -82,6 +82,8 @@ _check_master() {
commit v2ray
set glorytun.vpn.host=$ip
commit glorytun
glorytun-udp.vpn.host=$ip
commit glorytun
set dsvpn.vpn.host=$ip
commit dsvpn
set mlvpn.general.host=$ip
@ -98,16 +100,20 @@ _check_master() {
/etc/init.d/openvpn restart >/dev/null 2>/dev/null
/etc/init.d/dsvpn restart >/dev/null 2>/dev/null
fi
else
logger -t "OMR-Tracker-Server" "Master server already up"
fi
config_load shadowsocks-libev
config_foreach _enable_redir ss_redir
count=$((count+1))
else
logger -t "OMR-Tracker-Server" "Master server down"
config_load shadowsocks-libev
config_foreach _disable_redir ss_redir
fi
countips=$((countips+1))
}
config_load openmptcprouter
config_list_foreach $1 ip set_ip
#if [ "$server_ping" = true ] && [ "$countips" = "1" ]; then
# uci -q batch <<-EOF >/dev/null
@ -149,6 +155,8 @@ _check_backup() {
commit v2ray
set glorytun.vpn.host=$ip
commit glorytun
glorytun-udp.vpn.host=$ip
commit glorytun
set dsvpn.vpn.host=$ip
commit dsvpn
set mlvpn.general.host=$ip
@ -176,6 +184,7 @@ _check_backup() {
fi
countips=$((countips+1))
}
config_load openmptcprouter
config_list_foreach $1 ip set_ip
#if [ "$server_ping" = true ] && [ "$countips" = "1" ]; then
# uci -q batch <<-EOF >/dev/null
@ -202,6 +211,7 @@ while true; do
config_load openmptcprouter
config_foreach _check_master server
[ "$server_ping" = false ] && {
config_load openmptcprouter
config_foreach _check_backup server
}
sleep "${interval}"