mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add a speedtest using speedtest.net servers and use multiples sources for omr-test-speed
This commit is contained in:
parent
3b2c2ac9ea
commit
3b17a96c9b
2 changed files with 59 additions and 5 deletions
35
openmptcprouter/files/bin/omr-speedtest
Executable file
35
openmptcprouter/files/bin/omr-speedtest
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
INTERFACE="$1"
|
||||
echo "Download server list..."
|
||||
wget -q -O /tmp/speedtest.lst http://c.speedtest.net/speedtest-servers-static.php
|
||||
bestuploadurl=""
|
||||
besthost=""
|
||||
bestpinghost=""
|
||||
bestping="999"
|
||||
echo "Select best server..."
|
||||
while read line; do
|
||||
if [ "$(echo $line | grep url)" != "" ]; then
|
||||
pinghost=$(echo $line | awk -F'"' '{print $18}' | cut -d: -f1)
|
||||
host=$(echo $line | awk -F'"' '{print $18}')
|
||||
uploadurl=$(echo $line | awk -F'"' '{print $2}')
|
||||
ping=$(ping -c1 -w1 $pinghost | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||
echo -n "."
|
||||
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
|
||||
bestping=$ping
|
||||
bestuploadurl=$uploadurl
|
||||
besthost=$host
|
||||
bestpinghost=$pinghost
|
||||
fi
|
||||
fi
|
||||
done < /tmp/speedtest.lst
|
||||
echo
|
||||
echo "Done: url: $bestuploadurl - host: $besthost - ping: $bestping"
|
||||
echo "Download test:"
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
curl -4 $besthost/speedtest/random7000x7000.jpg >/dev/null || echo
|
||||
else
|
||||
hostip=$(dig +short $bestpinghost | tr -d "\n")
|
||||
ipset add ss_rules_dst_bypass_all $hostip
|
||||
curl -4 --interface $INTERFACE $besthost/speedtest/random7000x7000.jpg >/dev/null || echo
|
||||
ipset del ss_rules_dst_bypass_all $hostip
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue