Commit 0c55d482 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-health: add SOCKS5 proxy check for each gateway

Check TCP connectivity to port 1080 on each gateway IP. Result is included as "proxy":true/false in health.json for web UI display. Co-Authored-By: 's avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
parent a1508fb0
...@@ -299,10 +299,17 @@ for routes_dir in "$ROUTES_DIR" "$ROUTES6_DIR" ; do ...@@ -299,10 +299,17 @@ for routes_dir in "$ROUTES_DIR" "$ROUTES6_DIR" ; do
iperf_s=$(grep "^${tag} " "$IPERF_DATA" 2>/dev/null | awk '{print $2}') iperf_s=$(grep "^${tag} " "$IPERF_DATA" 2>/dev/null | awk '{print $2}')
iperf_mark="" ; [ "$iperf_s" = "0" ] && iperf_mark=",iperf=FAIL" iperf_mark="" ; [ "$iperf_s" = "0" ] && iperf_mark=",iperf=FAIL"
# Check SOCKS5 proxy (port 1080) on gateway
proxy_ok=""
if timeout 2 bash -c "echo | nc -w1 $gw_ip 1080" >/dev/null 2>&1 ; then
proxy_ok=1
fi
json_gw="{\"tag\":\"$tag\",\"ip\":\"$gw_ip\",\"status\":\"$st\"" json_gw="{\"tag\":\"$tag\",\"ip\":\"$gw_ip\",\"status\":\"$st\""
[ -n "$loss" ] && json_gw="$json_gw,\"loss\":$loss" [ -n "$loss" ] && json_gw="$json_gw,\"loss\":$loss"
[ "$vpn" = "0" ] && json_gw="$json_gw,\"vpn_down\":true" [ "$vpn" = "0" ] && json_gw="$json_gw,\"vpn_down\":true"
[ "$iperf_s" = "0" ] && json_gw="$json_gw,\"iperf_fail\":true" [ "$iperf_s" = "0" ] && json_gw="$json_gw,\"iperf_fail\":true"
[ -n "$proxy_ok" ] && json_gw="$json_gw,\"proxy\":true"
json_gw="$json_gw}" json_gw="$json_gw}"
json_gws="${json_gws:+$json_gws,}$json_gw" json_gws="${json_gws:+$json_gws,}$json_gw"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment