function fw::restore_block_rules() {
  while IFS= read -r peer_name; do
    local block_file
    block_file="$(ctx::block::path "${peer_name}.block")"
    [[ ! -f "$block_file" ]] && 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
      case "$btype" in
        full)   fw::block_all "$client_ip" "$peer_name" ;;
        ip)     fw::block_ip "$client_ip" "$target" ;;
        port)   fw::block_port "$client_ip" "$target" "$port" "${proto:-tcp}" ;;
        subnet) fw::block_subnet "$client_ip" "$target" ;;
      esac
    done < <(json::block_get_rules "$block_file")
  done < <(peers::all)
}