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:
suyuan 2024-01-11 23:07:47 +08:00
commit 31ad833a71
45 changed files with 8194 additions and 539 deletions

View file

@ -37,6 +37,29 @@ _check_server() {
done
}
_check_server_intf() {
local host=$1
local port=$2
local k=0
for intf in $(multipath | awk '/default/ {print $1}'); do
while [ "$server_ping" = false ] && [ "$k" -le "$retry" ]; do
ret=$(curl \
--max-time "$OMR_TRACKER_TIMEOUT" \
-s \
-k \
--interface $intf
"https://${host}:${port}/"
)
[ -n "$ret" ] && {
server_ping=true
return
}
k=$((k+1))
sleep "${intervaltries}"
done
done
}
_disable_current() {
local serv=$1
config_set $serv current "0"
@ -80,7 +103,8 @@ _check_master() {
fi
[ -z "$ip" ] && return
#_ping_server $ip
_check_server $ip $port
#_check_server $ip $port
_check_server_intf $ip $port
if [ "$server_ping" = true ]; then
if [ "$(uci -q get shadowsocks-libev.sss${count}.server | tr -d '\n')" != "$ip" ]; then
logger -t "OMR-Tracker-Server" "Master server ${name} up ($ip), set it back"
@ -221,7 +245,8 @@ _check_backup() {
[ -n "$ip6resolve" ] && ip="$ip6resolve"
fi
#_ping_server $ip
_check_server $ip $port
#_check_server $ip $port
_check_server_intf $ip $port
#[ "$server_ping" = true ] && [ "$(uci -q get shadowsocks-libev.sss${count}.server | tr -d '\n')" = "$ip" ] && break
if [ "$server_ping" = true ]; then
if [ "$(uci -q get shadowsocks-libev.sss${count}.server | tr -d '\n')" != "$ip" ]; then

View file

@ -4,9 +4,9 @@
name=$0
basename="$(basename $0)"
if [ -f /usr/sbin/iptables-legacy ]; then
IPTABLES="/usr/sbin/iptables-legacy"
IPTABLESSAVE="/usr/sbin/iptables-legacy-save"
if [ -e /usr/sbin/iptables-nft ]; then
IPTABLES="/usr/sbin/iptables-nft"
IPTABLESSAVE="/usr/sbin/iptables-nft-save"
else
IPTABLES="/usr/sbin/iptables"
IPTABLESSAVE="/usr/sbin/iptables-save"
@ -103,7 +103,7 @@ while true; do
script_alert_up="$(uci -q get omr-tracker.proxy.script_alert_up)"
[ -n "$script_alert_up" ] && eval $script_alert_up
}
if [ -z "$($IPTABLESSAVE 2>/dev/null | grep :ssr)" ]; then
if [ -z "$($IPTABLESSAVE 2>/dev/null | grep :ssr)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep ss_r)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep ssr_r)" ]; then
if [ "$type" = "libev" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ]; then
_log "Reload Shadowsocks rules"
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null
@ -120,7 +120,7 @@ while true; do
last=$((last + 1 ))
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
[ "${last}" -ge "${retry}" ] && {
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ssr)" ]; then
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ssr)" ] || [ -n "$(nft list ruleset 2>/dev/null | grep ss_r)" ] || [ -n "$(nft list ruleset 2>/dev/null | grep ssr_r)" ]; then
_log "Shadowsocks ${server} is down (can't contact via http ${nocontact})"
OMR_TRACKER_STATUS_MSG="Shadowsocks ${server} is down (can't contact via http ${nocontact})"
uci -q set openmptcprouter.omr.ss_${server}="down"

View file

@ -4,8 +4,8 @@
name=$0
basename="$(basename $0)"
if [ -f /usr/sbin/iptables-legacy ]; then
IPTABLES="/usr/sbin/iptables-legacy"
if [ -e /usr/sbin/iptables-nft ]; then
IPTABLES="/usr/sbin/iptables-nft"
else
IPTABLES="/usr/sbin/iptables"
fi
@ -100,7 +100,7 @@ while true; do
script_alert_up="$(uci -q get omr-tracker.proxy.script_alert_up)"
[ -n "$script_alert_up" ] && eval $script_alert_up
}
if [ -z "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^v2r)" ]; then
if [ -z "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^v2r)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep 'chain v2r')" ]; then
_log "Reload V2Ray rules"
/etc/init.d/v2ray rules_up 2> /dev/null
_get_ip
@ -111,7 +111,7 @@ while true; do
last=$((last + 1 ))
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
[ "${last}" -ge "${retry}" ] && {
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^v2r)" ]; then
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^v2r)" ] || [ -n "$(nft list ruleset 2>/dev/null | grep 'chain v2r')" ]; then
_log "V2Ray is down (can't contact via http ${nocontact})"
OMR_TRACKER_STATUS_MSG="V2Ray is down (can't contact via http ${nocontact})"
uci -q set openmptcprouter.omr.v2ray="down"

View file

@ -4,8 +4,8 @@
name=$0
basename="$(basename $0)"
if [ -f /usr/sbin/iptables-legacy ]; then
IPTABLES="/usr/sbin/iptables-legacy"
if [ -e /usr/sbin/iptables-nft ]; then
IPTABLES="/usr/sbin/iptables-nft"
else
IPTABLES="/usr/sbin/iptables"
fi
@ -100,7 +100,7 @@ while true; do
script_alert_up="$(uci -q get omr-tracker.proxy.script_alert_up)"
[ -n "$script_alert_up" ] && eval $script_alert_up
}
if [ -z "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^xr)" ]; then
if [ -z "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^xr)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep 'chain xr')" ]; then
_log "Reload xray rules"
/etc/init.d/xray rules_up 2> /dev/null
_get_ip
@ -111,7 +111,7 @@ while true; do
last=$((last + 1 ))
[ -z "$nocontact" ] && nocontact="$host" || nocontact="$nocontact, $host"
[ "${last}" -ge "${retry}" ] && {
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^xr)" ]; then
if [ -n "$($IPTABLES -w -t nat -L -n 2>/dev/null | grep ^xr)" ] || [ -n "$(nft list ruleset 2>/dev/null | grep 'chain xr')" ]; then
_log "xray is down (can't contact via http ${nocontact})"
OMR_TRACKER_STATUS_MSG="xray is down (can't contact via http ${nocontact})"
uci -q set openmptcprouter.omr.xray="down"