onlyrickroll commited on
Commit
e15aecf
·
verified ·
1 Parent(s): 43f2b16

Update test.sh

Browse files
Files changed (1) hide show
  1. test.sh +4 -4
test.sh CHANGED
@@ -1,20 +1,20 @@
1
  #!/bin/bash
2
 
3
  # --- 1. 获取并并行测试 SOCKS5 代理 (使用前面优化过的逻辑) ---
4
- PROXY_SOURCE="https://cdn.jsdelivr.net/gh/proxifly/free-proxy-list@main/proxies/protocols/socks5/data.txt"
5
  TEST_TARGET="https://api.telegram.org"
6
  TEMP_DIR="/tmp/proxy_test"
7
  mkdir -p $TEMP_DIR && rm -rf $TEMP_DIR/*
8
 
9
- echo "--- 正在获取 SOCKS5 列表 ---"
10
  curl -sL $PROXY_SOURCE | head -n 250 > $TEMP_DIR/list.txt
11
 
12
  echo "--- 并行测试代理 (250个) ---"
13
  test_proxy() {
14
  local ip_port=$1
15
  local id=$2
16
- if curl -s --socks5 "$ip_port" --connect-timeout 4 "$TEST_TARGET" > /dev/null; then
17
- echo "socks5://$ip_port" > "$TEMP_DIR/success_$id"
18
  else
19
  echo "failed"
20
  fi
 
1
  #!/bin/bash
2
 
3
  # --- 1. 获取并并行测试 SOCKS5 代理 (使用前面优化过的逻辑) ---
4
+ PROXY_SOURCE="https://cdn.jsdelivr.net/gh/proxifly/free-proxy-list@main/proxies/protocols/http/data.txt"
5
  TEST_TARGET="https://api.telegram.org"
6
  TEMP_DIR="/tmp/proxy_test"
7
  mkdir -p $TEMP_DIR && rm -rf $TEMP_DIR/*
8
 
9
+ echo "--- 正在获取 http 列表 ---"
10
  curl -sL $PROXY_SOURCE | head -n 250 > $TEMP_DIR/list.txt
11
 
12
  echo "--- 并行测试代理 (250个) ---"
13
  test_proxy() {
14
  local ip_port=$1
15
  local id=$2
16
+ if curl -s --proxy "$ip_port" --connect-timeout 4 "$TEST_TARGET" > /dev/null; then
17
+ echo "http://$ip_port" > "$TEMP_DIR/success_$id"
18
  else
19
  echo "failed"
20
  fi