function cmd::unblock::_unblock_all() { local name="${1:?name required}" local client_ip="${2:?client_ip required}" local quiet="${3:-false}" local block_file block_file="$(ctx::block::path "${name}.block")" # Set direct block to false block::set_direct "$name" "$client_ip" "false" local still_blocked still_blocked=$(block::is_blocked "$name") # Only actually unblock if no groups still blocking if [[ "$still_blocked" != "true" ]]; then fw::unblock_all "$client_ip" fw::flush_peer "$client_ip" fw::remove_block_file "$name" monitor::unwatch_client "$name" if ! peers::exists_in_server "$name"; then local public_key public_key=$(keys::public "$name") || return 1 peers::add_to_server "$name" "$public_key" "$client_ip" peers::reload fi $quiet || log::wg_success "${name} has been unblocked." else $quiet || log::wg_warning "${name} still blocked by group(s)" fi }