Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e3ff3f9
Update download_proxies.yml
vAHiD55555 Oct 16, 2025
9dc17a9
update proxies
github-actions[bot] Oct 16, 2025
e8a4168
update proxies
github-actions[bot] Oct 16, 2025
cd10619
update proxies
github-actions[bot] Oct 16, 2025
ccf325c
update proxies
github-actions[bot] Oct 16, 2025
3e54653
update proxies
github-actions[bot] Oct 16, 2025
1f4fc8a
update proxies
github-actions[bot] Oct 16, 2025
6583cb7
update proxies
github-actions[bot] Oct 16, 2025
61872b2
update proxies
github-actions[bot] Oct 16, 2025
8c42ad1
update proxies
github-actions[bot] Oct 16, 2025
db6ac1e
update proxies
github-actions[bot] Oct 16, 2025
dc822cd
update proxies
github-actions[bot] Oct 16, 2025
463d215
update proxies
github-actions[bot] Oct 16, 2025
1d07a4d
update proxies
github-actions[bot] Oct 16, 2025
d9fc097
update proxies
github-actions[bot] Oct 16, 2025
555157f
Add proxy check workflow configuration
vAHiD55555 Oct 16, 2025
b63e923
Update proxy-check.yml
vAHiD55555 Oct 16, 2025
25f6b23
update proxies
github-actions[bot] Oct 16, 2025
33fd331
update proxies
github-actions[bot] Oct 16, 2025
722559f
update proxies
github-actions[bot] Oct 16, 2025
4d7072e
Add check_and_make_pac.sh for proxy validation
vAHiD55555 Oct 16, 2025
bc06e08
update proxies
github-actions[bot] Oct 16, 2025
b2152db
Add workflow to check proxies and create PAC file
vAHiD55555 Oct 16, 2025
e0b41d7
update proxies
github-actions[bot] Oct 16, 2025
299fd6b
Add .circleci/config.yml
vAHiD55555 Oct 16, 2025
78bc9a8
Update config.yml
vAHiD55555 Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# As simple as adding the below to your config to get started

- run:
name: Plan a deploy
command: circleci run release plan --target-version=<some-version-name>

# Your job here doing the actual deployment
...

- run:
name: Update a deploy to SUCCESS
command: circleci run release update --status=SUCCESS
when: on_success
- run:
name: Update planned deploy to FAILED
command: circleci run release update --status=FAILED
when: on_fail
...
2 changes: 1 addition & 1 deletion .github/workflows/download_proxies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run Proxies

on:
schedule:
- cron: '*/5 * * * *'
- cron: '*/1 * * * *'

jobs:
run-proxies:
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/make_pac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
- name: Add script
run: |
mkdir -p scripts
cat > scripts/check_and_make_pac.sh <<'EOF'
# (#!/usr/bin/env bash
set -euo pipefail

TIMEOUT=8
CHECK_URL="https://api.ipify.org"
OUT_PAC="proxies.pac"
OK_LIST="proxies_ok.txt"
BAD_LIST="proxies_failed.txt"
TMPDIR="tmp"
MAX_JOBS=12

rm -f "$OK_LIST" "$BAD_LIST" "$OUT_PAC"
touch "$OK_LIST" "$BAD_LIST"

merge_files() {
local f="$1"
if [[ -f "$f" ]]; then
sed 's/#.*//g' "$f" | awk '{$1=$1};1' | grep -E '.+' || true
fi
}

echo "[*] خواندن IP خارجی..."
LOCAL_IP=$(curl -s --max-time $TIMEOUT $CHECK_URL || echo "unknown")
echo "IP شما: $LOCAL_IP"

PROXIES=()
for line in $(merge_files "$TMPDIR/http.txt"); do
PROXIES+=("$line")
done
for line in $(merge_files "$TMPDIR/socks5.txt"); do
PROXIES+=("$line")
done
if [[ -f "proxies.txt" ]]; then
while IFS= read -r l; do
[[ -z "$l" ]] && continue
PROXIES+=("$l")
done < proxies.txt
fi

echo "[*] تعداد کل پراکسی‌ها: ${#PROXIES[@]}"

test_proxy_once() {
proxy="$1"
proto=""
target="$proxy"
if [[ "$proxy" =~ ^socks5 ]]; then
proto="socks5"
target="${proxy#*://}"
elif [[ "$proxy" =~ ^https?:// ]]; then
proto="http"
target="${proxy#*://}"
elif echo "$proxy" | grep -q ':'; then
proto="http"
target="$proxy"
else
return 1
fi

if [[ "$proto" == "socks5" ]]; then
curl_opts=(--socks5-hostname "$target")
else
curl_opts=(-x "http://$target")
fi
out=$(curl -s "${curl_opts[@]}" --max-time $TIMEOUT --connect-timeout $TIMEOUT "$CHECK_URL" 2>/dev/null || echo "")
if [[ -n "$out" && "$out" != "$LOCAL_IP" ]]; then
echo "$proxy" >> "$OK_LIST"
return 0
else
echo "$proxy" >> "$BAD_LIST"
return 1
fi
}

export -f test_proxy_once
export OK_LIST BAD_LIST LOCAL_IP TIMEOUT CHECK_URL

printf "%s\n" "${PROXIES[@]}" | xargs -P $MAX_JOBS -I {} bash -c 'test_proxy_once "$@"' _ {}

echo "[*] تعداد پراکسی سالم: $(wc -l < "$OK_LIST")"
echo "[*] تعداد پراکسی خراب: $(wc -l < "$BAD_LIST")"

# ساخت فایل PAC ساده
cat > "$OUT_PAC" <<EOF
function FindProxyForURL(url, host) {
var proxy = "PROXY $(head -n 1 $OK_LIST)";
return proxy + "; DIRECT";
}
EOF

echo "[*] کار تمام شد. خروجی PAC: $OUT_PAC")
EOF
chmod +x scripts/check_and_make_pac.sh
- name: Run proxy check & make PAC
run: bash scripts/check_and_make_pac.sh
114 changes: 114 additions & 0 deletions .github/workflows/proxy-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Proxy Check & Build PAC

on:
push:
branches: [ main ]
schedule:
- cron: "0 2 * * *" # هر روز ساعت 02:00 UTC (در صورت نیاز تغییر بده)
workflow_dispatch:

jobs:
proxy-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up environment
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends curl git ca-certificates

- name: Download proxy lists
env:
HTTP_LIST: https://raw.githubusercontent.com/vAHiD55555/ProxyScraper_/refs/heads/main/proxies/http.txt
SOCKS_LIST: https://raw.githubusercontent.com/vAHiD55555/ProxyScraper_/refs/heads/main/proxies/socks.txt
run: |
mkdir -p tmp
echo "[*] fetching http list..."
curl -fsSL "$HTTP_LIST" -o tmp/http.txt || true
echo "[*] fetching socks5 list..."
curl -fsSL "$SOCKS_LIST" -o tmp/socks5.txt || true
wc -l tmp/*.txt || true

- name: Add script
run: |
mkdir -p scripts
cat > scripts/check_and_make_pac.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

TIMEOUT=8
CHECK_URL="https://api.ipify.org"
OUT_PAC="proxies.pac"
OK_LIST="proxies_ok.txt"
BAD_LIST="proxies_failed.txt"
TMPDIR="tmp"
MAX_JOBS=12

# normalize and merge lists
rm -f "$OK_LIST" "$BAD_LIST" "$OUT_PAC"
touch "$OK_LIST" "$BAD_LIST"

merge_files() {
local f="$1"
if [[ -f "$f" ]]; then
# remove blanks and comments, trim
sed 's/#.*//g' "$f" | awk '{$1=$1};1' | grep -E '.+' || true
fi
}

echo "[*] reading local external IP..."
LOCAL_IP=$(curl -s --max-time $TIMEOUT $CHECK_URL || echo "unknown")
echo "LOCAL_IP=$LOCAL_IP"

# build proxy array
PROXIES=()

for line in $(merge_files "$TMPDIR/http.txt"); do
PROXIES+=("$line")
done
for line in $(merge_files "$TMPDIR/socks5.txt"); do
PROXIES+=("$line")
done

# also allow proxies in repo root proxies.txt if present
if [[ -f "proxies.txt" ]]; then
while IFS= read -r l; do
[[ -z "$l" ]] && continue
PROXIES+=("$l")
done < proxies.txt
fi

echo "[*] total candidate proxies: ${#PROXIES[@]}"

# function to test one proxy
test_proxy_once() {
proxy="$1"
# normalize: ensure schema
proto=""
target="$proxy"
if [[ "$proxy" =~ ^socks5?:// ]]; then
proto="socks5"
target="${proxy#*://}"
elif [[ "$proxy" =~ ^https?:// ]]; then
proto="http"
target="${proxy#*://}"
elif echo "$proxy" | grep -q ':'; then
proto="http"
target="$proxy"
else
return 1
fi

if [[ "$proto" == "socks5" ]]; then
curl_opts=(--socks5-hostname "$target")
else
curl_opts=(-x "http://$target")
fi

# try to get external IP via that proxy
out=$(curl -s "${curl_opts[@]}" --max-time $TIMEOUT --connect-timeout $TIMEOUT "$CHECK_URL" 2>/dev/null || echo "")
if
90 changes: 90 additions & 0 deletions check_and_make_pac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env bash
set -euo pipefail

TIMEOUT=8
CHECK_URL="https://api.ipify.org"
OUT_PAC="proxies.pac"
OK_LIST="proxies_ok.txt"
BAD_LIST="proxies_failed.txt"
TMPDIR="tmp"
MAX_JOBS=12

rm -f "$OK_LIST" "$BAD_LIST" "$OUT_PAC"
touch "$OK_LIST" "$BAD_LIST"

merge_files() {
local f="$1"
if [[ -f "$f" ]]; then
sed 's/#.*//g' "$f" | awk '{$1=$1};1' | grep -E '.+' || true
fi
}

echo "[*] خواندن IP خارجی..."
LOCAL_IP=$(curl -s --max-time $TIMEOUT $CHECK_URL || echo "unknown")
echo "IP شما: $LOCAL_IP"

PROXIES=()
for line in $(merge_files "$TMPDIR/http.txt"); do
PROXIES+=("$line")
done
for line in $(merge_files "$TMPDIR/socks5.txt"); do
PROXIES+=("$line")
done
if [[ -f "proxies.txt" ]]; then
while IFS= read -r l; do
[[ -z "$l" ]] && continue
PROXIES+=("$l")
done < proxies.txt
fi

echo "[*] تعداد کل پراکسی‌ها: ${#PROXIES[@]}"

test_proxy_once() {
proxy="$1"
proto=""
target="$proxy"
if [[ "$proxy" =~ ^socks5 ]]; then
proto="socks5"
target="${proxy#*://}"
elif [[ "$proxy" =~ ^https?:// ]]; then
proto="http"
target="${proxy#*://}"
elif echo "$proxy" | grep -q ':'; then
proto="http"
target="$proxy"
else
return 1
fi

if [[ "$proto" == "socks5" ]]; then
curl_opts=(--socks5-hostname "$target")
else
curl_opts=(-x "http://$target")
fi
out=$(curl -s "${curl_opts[@]}" --max-time $TIMEOUT --connect-timeout $TIMEOUT "$CHECK_URL" 2>/dev/null || echo "")
if [[ -n "$out" && "$out" != "$LOCAL_IP" ]]; then
echo "$proxy" >> "$OK_LIST"
return 0
else
echo "$proxy" >> "$BAD_LIST"
return 1
fi
}

export -f test_proxy_once
export OK_LIST BAD_LIST LOCAL_IP TIMEOUT CHECK_URL

printf "%s\n" "${PROXIES[@]}" | xargs -P $MAX_JOBS -I {} bash -c 'test_proxy_once "$@"' _ {}

echo "[*] تعداد پراکسی سالم: $(wc -l < "$OK_LIST")"
echo "[*] تعداد پراکسی خراب: $(wc -l < "$BAD_LIST")"

# ساخت فایل PAC ساده
cat > "$OUT_PAC" <<EOF
function FindProxyForURL(url, host) {
var proxy = "PROXY $(head -n 1 $OK_LIST)";
return proxy + "; DIRECT";
}
EOF

echo "[*] کار تمام شد. خروجی PAC: $OUT_PAC"
Loading