All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Register

Login

All New Register Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 while IFS="|" read -r name ip rule subtype last_ts last_evt; do
2 [[ -z "$name" ]] && continue
3 local ip="${p_ips[$client_name]:-}"
4 if [[ -z "$ip" ]]; then
5 ip=$(grep "^Address" "$conf" | awk '{print $3}' | cut -d'/' -f1)
6 fi
7 p_ips["$name"]="$ip"
8 p_rules["$name"]="${rule:-—}"
9 p_subtypes["$name"]="$subtype"
10 p_last_ts["$name"]="$last_ts"

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 # Group summary
2 local group_summary=""
3 if $has_groups; then
4 declare -A group_counts
5 for peer in "${!peer_group_map[@]}"; do
6 local g="${peer_group_map[$peer]}"
7 group_counts["$g"]=$(( ${group_counts["$g"]:-0} + 1 )) || true
8 done
9 for g in "${!group_counts[@]}"; do
10 group_summary+="${group_counts[$g]} in ${g}, "

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::group::list() {
2 local groups_dir
3 groups_dir="$(ctx::groups)"
4
5 local groups=("${groups_dir}"/*.group)
6 if [[ ! -f "${groups[0]}" ]]; then
7 log::wg "No groups configured"
8 return 0
9 fi

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 root@wireguard:~# grep -rn "while IFS.*peers::all\|for conf in.*\.conf\|peers::get_meta\|json::get\|peers::get_ip" \
2 > /etc/wireguard/wgctl/commands/ | grep -v "list.command" | grep -v "\.git"
3 /etc/wireguard/wgctl/commands/rule.command.sh:119: peer_rule=$(peers::get_meta "$peer_name" "rule")
4 /etc/wireguard/wgctl/commands/rule.command.sh:132: name=$(json::get "$rule_file" "name")
5 /etc/wireguard/wgctl/commands/rule.command.sh:134: desc=$(json::get "$rule_file" "desc")
6 /etc/wireguard/wgctl/commands/rule.command.sh:137: n_allows=$(json::get "$rule_file" "allow_ips" | wc -l)
7 /etc/wireguard/wgctl/commands/rule.command.sh:138: n_allow_ports=$(json::get "$rule_file" "allow_ports" | wc -l)
8 /etc/wireguard/wgctl/commands/rule.command.sh:140: n_block_ips=$(json::get "$rule_file" "block_ips" | wc -l)
9 /etc/wireguard/wgctl/commands/rule.command.sh:141: n_block_ports=$(json::get "$rule_file" "block_ports" | wc -l)
10 /etc/wireguard/wgctl/commands/rule.command.sh:191: desc=$(json::get "$rule_file" "desc")

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Lifecycle
5 # ============================================
6
7 function cmd::list::on_load() {
8 flag::register --type
9 flag::register --online
10 flag::register --offline

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2 set -e
3
4 WGCTL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5 DATA_DIR="/etc/wireguard/.wgctl"
6
7 echo "Installing wgctl..."
8
9 install::dependencies
10 install::make_structure

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Lifecycle
5 # ============================================
6
7 function config::on_load() {
8 config::validate
9 }

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 Peer Rules
2 ──────────────────────────────────────────────────
3 ✅ desktop-roboclean rule=user fw: 6/6
4 ✅ desktop-test rule=user fw: 6/6
5 ✅ desktop-test1 rule=user fw: 6/6
6 ✅ guest-test rule=guest fw: 16/16
7 ✅ guest-test2 rule=guest fw: 16/16
8 ✅ guest-test3 rule=guest fw: 16/16
9 ✅ guest-test4 rule=guest fw: 16/16
10 ✅ guest-zephyr-test rule=moonlight-02 fw: 5/5

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::fw::list() {
2 local peer="" type=""
3 local show_nflog=true show_accept=true show_drop=true
4
5 while [[ $# -gt 0 ]]; do
6 case "$1" in
7 --peer) peer="$2"; shift 2 ;;
8 --type) type="$2"; shift 2 ;;
9 --no-nflog) show_nflog=false; shift ;;
10 --no-accept) show_accept=false; shift ;;

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::fw::list() {
2 local peer="" type=""
3 while [[ $# -gt 0 ]]; do
4 case "$1" in
5 --peer) peer="$2"; shift 2 ;;
6 --type) type="$2"; shift 2 ;;
7 *) shift ;;
8 esac
9 done
Newer Older

Powered by Opengist ⋅ Load: 106ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ KrilHub