forked from Iglesys347/castor
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c02c989
commit aab8b93
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
URL="https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/" | ||
COUNT=50 | ||
MULTISOCKS_PROXY="multisocks.dark:8080" | ||
LOCAL_TOR_PROXY="localhost:9050" | ||
|
||
function make_concurrent_requests() { | ||
local proxy_address=$1 | ||
echo "making $COUNT concurrent requests to $URL via SOCKS5 proxy at $proxy_address" | ||
local start_time=$(date +%s.%N) | ||
for i in $(seq 1 $COUNT); do | ||
curl -s -x socks5h://$proxy_address --connect-timeout 10 --retry 5 $URL > /dev/null & | ||
done | ||
wait | ||
local end_time=$(date +%s.%N) | ||
local elapsed=$(echo "$end_time - $start_time" | bc) | ||
echo "time taken for $COUNT concurrent requests through proxy ($proxy_address): $elapsed seconds" | ||
} | ||
|
||
function check_latency() { | ||
local proxy_address=$1 | ||
local time_taken=$(curl -o /dev/null -s -w '%{time_total}\n' -x socks5://$proxy_address $URL) | ||
echo "latency for a request through $proxy_address: $time_taken seconds" | ||
} | ||
|
||
check_latency $MULTISOCKS_PROXY | ||
make_concurrent_requests $MULTISOCKS_PROXY | ||
|
||
check_latency $LOCAL_TOR_PROXY | ||
make_concurrent_requests $LOCAL_TOR_PROXY |