testing
This commit is contained in:
7
piawg.sh
7
piawg.sh
@@ -8,7 +8,10 @@
|
|||||||
msg() { printf '[%s]: %s\n' "${2-INFO}" "$1"; }
|
msg() { printf '[%s]: %s\n' "${2-INFO}" "$1"; }
|
||||||
info() { [ "$PIAWG_VERBOSE" -eq 1 ] && msg "$1"; }
|
info() { [ "$PIAWG_VERBOSE" -eq 1 ] && msg "$1"; }
|
||||||
warn() { msg "$1" 'WARN'; }
|
warn() { msg "$1" 'WARN'; }
|
||||||
err() { msg "$1" 'ERROR'; exit 1; }
|
err() {
|
||||||
|
msg "$1" 'ERROR'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
check_http() { [ "$1" = "${2:-200}" ] && return 0 || return 1; }
|
check_http() { [ "$1" = "${2:-200}" ] && return 0 || return 1; }
|
||||||
check_token() { printf '%s\n' "$1" | grep -q '^[0-9A-Fa-f]\{128\}$'; }
|
check_token() { printf '%s\n' "$1" | grep -q '^[0-9A-Fa-f]\{128\}$'; }
|
||||||
@@ -86,6 +89,8 @@ pia_addkey() {
|
|||||||
[ "$(printf '%s' "$response" | jq -r '.status')" != "OK" ] &&
|
[ "$(printf '%s' "$response" | jq -r '.status')" != "OK" ] &&
|
||||||
err "Failed to addKey to $server_cn"
|
err "Failed to addKey to $server_cn"
|
||||||
|
|
||||||
|
msg "$(echo "$response" | jq .)" 'DEBUG'
|
||||||
|
|
||||||
# Update Wireguard config on OPNsense
|
# Update Wireguard config on OPNsense
|
||||||
updates='{}'
|
updates='{}'
|
||||||
if [ "$server_ip" != "$piawgsrv_srvaddr" ]; then
|
if [ "$server_ip" != "$piawgsrv_srvaddr" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user