1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix omr-test-speed

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-08-09 21:57:11 +02:00
parent 33ef12e7e3
commit 8f5b99689f

View file

@ -19,7 +19,7 @@ INTERFACE="$i"
exit 0 exit 0
} }
[ "$FASTTEST" ] || echo "Select best test server..." [ "$FASTTEST" = true ] || echo "Select best test server..."
HOSTLST="http://scaleway.testdebit.info/10G.iso http://bordeaux.testdebit.info/10G.iso http://aix-marseille.testdebit.info/10G.iso http://lyon.testdebit.info/10G.iso http://lille.testdebit.info/10G.iso http://paris.testdebit.info/10G.iso http://appliwave.testdebit.info/10G/10G.iso http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://speedtest.milkywan.fr/files/10G.iso" HOSTLST="http://scaleway.testdebit.info/10G.iso http://bordeaux.testdebit.info/10G.iso http://aix-marseille.testdebit.info/10G.iso http://lyon.testdebit.info/10G.iso http://lille.testdebit.info/10G.iso http://paris.testdebit.info/10G.iso http://appliwave.testdebit.info/10G/10G.iso http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://speedtest.milkywan.fr/files/10G.iso"
bestping="9999" bestping="9999"
for pinghost in $HOSTLST; do for pinghost in $HOSTLST; do
@ -29,7 +29,7 @@ for pinghost in $HOSTLST; do
else else
ping=$(ping -4 -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n') ping=$(ping -4 -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
fi fi
[ "$FASTTEST" ] || echo "host: $domain - ping: $ping" [ "$FASTTEST" = true ] || echo "host: $domain - ping: $ping"
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
bestping=$ping bestping=$ping
HOST=$pinghost HOST=$pinghost
@ -38,7 +38,7 @@ done
[ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin" [ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
[ "$FASTTEST" ] || echo "Best server is $HOST, running test:" [ "$FASTTEST" = true ] || echo "Best server is $HOST, running test:"
trap : HUP INT TERM trap : HUP INT TERM
if [ -z "$INTERFACE" ]; then if [ -z "$INTERFACE" ]; then
curl -4 -o /dev/null $HOST || echo curl -4 -o /dev/null $HOST || echo
@ -51,11 +51,11 @@ else
ipset add ss_rules_dst_bypass_all $ip ipset add ss_rules_dst_bypass_all $ip
done done
fi fi
if [ "$FASTTEST" ]; then if [ "$FASTTEST" = true ]; then
avg_speed=$(curl -4 --max-time 10 -o /dev/null -qfsS -w '%{speed_download}' --interface $INTERFACE $HOST 2>/dev/null) avg_speed=$(curl -4 --max-time 10 -o /dev/null -qfsS -w '%{speed_download}' --interface $INTERFACE $HOST 2>/dev/null)
echo "$avg_speed" echo "$avg_speed"
else else
curl -4 --max-time 4 -o /dev/null --interface $INTERFACE $HOST || echo curl -4 -o /dev/null --interface $INTERFACE $HOST || echo
fi fi
if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then
for ip in $hostip; do for ip in $hostip; do