-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy-health-check.sh
More file actions
59 lines (49 loc) · 1.52 KB
/
proxy-health-check.sh
File metadata and controls
59 lines (49 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Proxy Health Checker with Auto-Rotation
# Tests all proxies and updates config if primary proxies fail
PROXIES=(
"31.59.20.176:6754"
"45.38.107.97:6014"
"198.23.239.134:6540"
"107.172.163.27:6543"
"64.137.96.74:6641"
"216.10.27.159:6837"
"142.111.67.146:5611"
"142.147.128.93:6593"
)
PROXY_USER="pjukyfij"
PROXY_PASS="3q9caatdky72"
echo "=== Proxy Health Check ==="
echo ""
WORKING_PROXIES=()
for proxy in "${PROXIES[@]}"; do
echo -n "Testing $proxy... "
# Test proxy with 5 second timeout
RESULT=$(curl --connect-timeout 5 --max-time 5 \
--proxy "http://$PROXY_USER:$PROXY_PASS@$proxy/" \
https://ipv4.webshare.io/ 2>&1)
if echo "$RESULT" | grep -qE "^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$"; then
echo "✅ OK"
WORKING_PROXIES+=("http://$PROXY_USER:$PROXY_PASS@$proxy/")
else
echo "❌ FAILED (timeout or error)"
fi
done
echo ""
echo "=== Results ==="
echo "Working Proxies: ${#WORKING_PROXIES[@]}"
echo "Failed Proxies: $((${#PROXIES[@]} - ${#WORKING_PROXIES[@]}))"
echo ""
if [ ${#WORKING_PROXIES[@]} -ge 3 ]; then
echo "✅ Enough working proxies (${#WORKING_PROXIES[@]}/3 needed)"
echo ""
echo "Top 3 working proxies for config:"
for i in {0..2}; do
if [ $i -lt ${#WORKING_PROXIES[@]} ]; then
echo " Proxy $i: ${WORKING_PROXIES[$i]}"
fi
done
else
echo "⚠️ WARNING: Only ${#WORKING_PROXIES[@]} working proxies (need 3)"
echo "Consider running without proxies temporarily"
fi