Update wireguard.sh

This commit is contained in:
Teddysun 2019-09-24 21:45:10 +09:00
parent 3e27b32449
commit c09c313278
No known key found for this signature in database
GPG Key ID: 09BD4C080AD6C46D

View File

@ -423,7 +423,7 @@ install_completed() {
} }
add_client() { add_client() {
if ! _exists "wg" || ! _exists "wg-quick"; then if ! _is_installed; then
_red "WireGuard looks like not installed, please installed it try again\n" && exit 1 _red "WireGuard looks like not installed, please installed it try again\n" && exit 1
fi fi
default_server_if="/etc/wireguard/${SERVER_WG_NIC}.conf" default_server_if="/etc/wireguard/${SERVER_WG_NIC}.conf"
@ -530,6 +530,9 @@ EOF
} }
remove_client() { remove_client() {
if ! _is_installed; then
_red "WireGuard looks like not installed, please installed it try again\n" && exit 1
fi
default_server_if="/etc/wireguard/${SERVER_WG_NIC}.conf" default_server_if="/etc/wireguard/${SERVER_WG_NIC}.conf"
[ ! -s "${default_server_if}" ] && echo "The default server interface ($(_red ${default_server_if})) does not exists" && exit 1 [ ! -s "${default_server_if}" ] && echo "The default server interface ($(_red ${default_server_if})) does not exists" && exit 1
while true while true
@ -557,6 +560,9 @@ remove_client() {
} }
list_clients() { list_clients() {
if ! _is_installed; then
_red "WireGuard looks like not installed, please installed it try again\n" && exit 1
fi
default_server_if="/etc/wireguard/${SERVER_WG_NIC}.conf" default_server_if="/etc/wireguard/${SERVER_WG_NIC}.conf"
[ ! -s "${default_server_if}" ] && echo "The default server interface ($(_red ${default_server_if})) does not exists" && exit 1 [ ! -s "${default_server_if}" ] && echo "The default server interface ($(_red ${default_server_if})) does not exists" && exit 1
local line="+-------------------------------------------------------------------------+\n" local line="+-------------------------------------------------------------------------+\n"