mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
Update omr-iperf script to automatically use current VPS and add omr-iperf-proxy and omr-iperf-vpn to check speed using VPN or Proxy
This commit is contained in:
parent
7688139d38
commit
e3ff7ac787
3 changed files with 41 additions and 11 deletions
|
@ -1,17 +1,45 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
SERVER=$1
|
#
|
||||||
shift
|
# Copyright (C) 2018-2025 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||||
[ -z "$SERVER" ] && SERVER="vps"
|
#
|
||||||
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
|
# See /LICENSE for more information.
|
||||||
|
#
|
||||||
|
|
||||||
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
get_auth_data() {
|
||||||
|
SERVER="$1"
|
||||||
|
config_get current $SERVER current
|
||||||
|
if [ "$current" = "1" ]; then
|
||||||
KEY=$(uci -q get iperf.$SERVER.key)
|
KEY=$(uci -q get iperf.$SERVER.key)
|
||||||
USER=$(uci -q get iperf.$SERVER.user)
|
USER=$(uci -q get iperf.$SERVER.user)
|
||||||
PASSWORD=$(uci -q get iperf.$SERVER.password)
|
PASSWORD=$(uci -q get iperf.$SERVER.password)
|
||||||
HOST=$(uci -q get iperf.$SERVER.host)
|
HOST=$(uci -q get iperf.$SERVER.host)
|
||||||
PORTS=$(uci -q get iperf.$SERVER.ports | sed 's/,/ /g')
|
PORTS=$(uci -q get iperf.$SERVER.ports | sed 's/,/ /g')
|
||||||
PORT="${PORTS%% *}"
|
PORT="${PORTS%% *}"
|
||||||
echo $KEY | base64 -d > /tmp/iperf.pem
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
config_load openmptcprouter
|
||||||
|
config_foreach get_auth_data server
|
||||||
|
|
||||||
if [ -n "$PASSWORD" ] && [ -n "$USER" ] && [ -n "$KEY" ]; then
|
if [ -n "$PASSWORD" ] && [ -n "$USER" ] && [ -n "$KEY" ]; then
|
||||||
|
echo $KEY | base64 -d > /tmp/iperf.pem
|
||||||
#IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem --use-pkcs1-padding -c $HOST -p $PORT ${@}
|
#IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem --use-pkcs1-padding -c $HOST -p $PORT ${@}
|
||||||
|
echo "machin: $0"
|
||||||
|
case "$0" in
|
||||||
|
*proxy)
|
||||||
|
IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem -c $HOST -p $PORT --socks5 127.0.0.1:1111 ${@}
|
||||||
|
;;
|
||||||
|
*vpn)
|
||||||
|
VPNIP=$(ip r show default metric 0 | awk '{ print $3 }' | tr -d '\n')
|
||||||
|
IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem -c $VPNIP -p $PORT
|
||||||
|
;;
|
||||||
|
*)
|
||||||
IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem -c $HOST -p $PORT ${@}
|
IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem -c $HOST -p $PORT ${@}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
iperf3 -c $HOST -p $PORT ${@}
|
iperf3 -c $HOST -p $PORT ${@}
|
||||||
fi
|
fi
|
||||||
|
|
1
openmptcprouter/files/bin/omr-iperf-proxy
Symbolic link
1
openmptcprouter/files/bin/omr-iperf-proxy
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
omr-iperf
|
1
openmptcprouter/files/bin/omr-iperf-vpn
Symbolic link
1
openmptcprouter/files/bin/omr-iperf-vpn
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
omr-iperf
|
Loading…
Reference in a new issue