gistfile1.txt
· 1.3 KiB · Text
Bruto
grep -A 15 "function block::restore_peer" \
> /etc/wireguard/wgctl/modules/block.module.sh
function block::restore_peer() {
local name="${1:?}" client_ip="${2:?}"
fw::unblock_all "$client_ip"
fw::flush_peer "$client_ip"
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
}
function block::restore_all() {
while IFS= read -r peer_name; do
block::has_file "$peer_name" || continue
grep -A 20 "function block::restore_peer" \
> /etc/wireguard/wgctl/modules/block.module.sh
function block::restore_peer() {
local name="${1:?}" client_ip="${2:?}"
fw::unblock_all "$client_ip"
fw::flush_peer "$client_ip"
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
}
function block::restore_all() {
while IFS= read -r peer_name; do
block::has_file "$peer_name" || continue
local client_ip
client_ip=$(peers::get_ip "$peer_name")
[[ -z "$client_ip" ]] && continue
while IFS="|" read -r bname btype target port proto; do
[[ -z "$btype" ]] && continue
| 1 | grep -A 15 "function block::restore_peer" \ |
| 2 | > /etc/wireguard/wgctl/modules/block.module.sh |
| 3 | function block::restore_peer() { |
| 4 | local name="${1:?}" client_ip="${2:?}" |
| 5 | fw::unblock_all "$client_ip" |
| 6 | fw::flush_peer "$client_ip" |
| 7 | monitor::unwatch_client "$name" |
| 8 | if ! peers::exists_in_server "$name"; then |
| 9 | local public_key |
| 10 | public_key=$(keys::public "$name") || return 1 |
| 11 | peers::add_to_server "$name" "$public_key" "$client_ip" |
| 12 | peers::reload |
| 13 | fi |
| 14 | } |
| 15 | |
| 16 | function block::restore_all() { |
| 17 | while IFS= read -r peer_name; do |
| 18 | block::has_file "$peer_name" || continue |
| 19 | |
| 20 | grep -A 20 "function block::restore_peer" \ |
| 21 | > /etc/wireguard/wgctl/modules/block.module.sh |
| 22 | function block::restore_peer() { |
| 23 | local name="${1:?}" client_ip="${2:?}" |
| 24 | fw::unblock_all "$client_ip" |
| 25 | fw::flush_peer "$client_ip" |
| 26 | monitor::unwatch_client "$name" |
| 27 | if ! peers::exists_in_server "$name"; then |
| 28 | local public_key |
| 29 | public_key=$(keys::public "$name") || return 1 |
| 30 | peers::add_to_server "$name" "$public_key" "$client_ip" |
| 31 | peers::reload |
| 32 | fi |
| 33 | } |
| 34 | |
| 35 | function block::restore_all() { |
| 36 | while IFS= read -r peer_name; do |
| 37 | block::has_file "$peer_name" || continue |
| 38 | local client_ip |
| 39 | client_ip=$(peers::get_ip "$peer_name") |
| 40 | [[ -z "$client_ip" ]] && continue |
| 41 | while IFS="|" read -r bname btype target port proto; do |
| 42 | [[ -z "$btype" ]] && continue |