onlyrickroll commited on
Commit
bdad380
·
verified ·
1 Parent(s): b3c6850

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +11 -5
entrypoint.sh CHANGED
@@ -82,11 +82,17 @@ echo "--- 并行测试代理可用性 (80个) ---"
82
 
83
  # 定义测试函数
84
  test_proxy() {
85
- local ip_port=$1
86
- local id=$2
87
- # 尝试连接,设置 4 秒超时
88
- if curl -s --socks5 "$ip_port" --connect-timeout 4 "$TEST_TARGET" > /dev/null; then
89
- echo "socks5://$ip_port" > "$TEMP_DIR/success_$id"
 
 
 
 
 
 
90
  fi
91
  }
92
  # 批量启动后台测试任务
 
82
 
83
  # 定义测试函数
84
  test_proxy() {
85
+ local proxy_url=$1 # 传入的格式是 socks5://ip:port
86
+ local id=$2
87
+
88
+ # 1. 使用 --socks5-hostname (对应 socks5h://)
89
+ # 确保 DNS 解析在远端进行
90
+ # 2. --connect-timeout 4 设置连接超时
91
+ # 3. -I 发送 HEAD 请求,比 GET 更快,只获取响应头
92
+
93
+ if curl -s -I --socks5-hostname "$proxy_url" --connect-timeout 4 "$TEST_TARGET" > /dev/null; then
94
+ # 如果 curl 返回 0 (成功),记录该代理
95
+ echo "$proxy_url" > "$TEMP_DIR/success_$id"
96
  fi
97
  }
98
  # 批量启动后台测试任务