Updated frkn tool
This commit is contained in:
parent
890f09b82b
commit
737da43522
@ -12,15 +12,38 @@ function connect() {
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function in_array() {
|
||||||
|
local find=$1
|
||||||
|
shift
|
||||||
|
for e in "$@"; do
|
||||||
|
[[ "$e" == "$find" ]] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
country="$1"
|
country="$1"
|
||||||
countries=(uk ru nl nl2 ch)
|
countries=()
|
||||||
current=$(sudo wg show | head -n 1 | awk '{print $2}')
|
current=$(sudo wg show | head -n 1 | awk '{print $2}')
|
||||||
|
|
||||||
|
for file in /etc/wireguard/*.conf; do
|
||||||
|
filename=${file/\/etc\/wireguard\/frkn-}
|
||||||
|
code=${filename/.conf/}
|
||||||
|
countries+=($code)
|
||||||
|
done
|
||||||
|
|
||||||
|
correct=-1
|
||||||
if [ -z "$country" ] ; then
|
if [ -z "$country" ] ; then
|
||||||
IFS= read -rp "Выбери страну (${countries[*]}): " country
|
while [ $correct -lt 0 ]; do
|
||||||
|
read -rp "Выбери страну (${countries[*]}): " country
|
||||||
|
if in_array "$country" ${countries[@]}; then
|
||||||
|
correct=1
|
||||||
|
else
|
||||||
|
echo "Неверный код страны!"
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $country in
|
case "$country" in
|
||||||
"down" )
|
"down" )
|
||||||
if [ -n "$current" ]; then
|
if [ -n "$current" ]; then
|
||||||
disconnect "$current"
|
disconnect "$current"
|
||||||
|
Loading…
Reference in New Issue
Block a user