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

nuno

Joined 4 months ago

Recently created
Least recently created
Recently updated
Least recently updated
All gists 582

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function cmd::identity::_rule_assign() {
2 local name="" rule=""
3 while [[ $# -gt 0 ]]; do
4 case "$1" in
5 --name) name="$2"; shift 2 ;;
6 --rule) rule="$2"; shift 2 ;;
7 *) log::error "Unknown flag: $1"; return 1 ;;
8 esac
9 done
10

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function rule::_apply_identity_rule() {
2 local peer_name="${1:-}" client_ip="${2:-}"
3
4 local identity_name
5 identity_name=$(identity::get_name "$peer_name")
6 [[ -z "$identity_name" ]] && return 0
7
8 local rules
9 rules=$(identity::rules "$identity_name")
10 [[ -z "$rules" ]] && return 0

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Rule File Parsing
5 # ============================================
6
7 function rule::is_base() {
8 local name="${1:-}"
9 [[ -f "$(ctx::rules::base)/${name}.rule" ]]
10 }

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2 # ui/subnet.module.sh — rendering for subnet data
3 # All functions pure rendering — no writes, no state changes.
4
5 function ui::subnet::header() {
6 printf " %-14s %-18s %-10s %-8s %s\n" \
7 "NAME" "SUBNET" "TYPE" "TUNNEL" "DESCRIPTION"
8 ui::divider 70
9 }

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2 # ui/identity.module.sh — rendering for identity data
3 # All functions pure rendering — no writes, no state changes.
4
5 function ui::identity::header() {
6 printf " %-20s %-7s %s\n" "IDENTITY" "PEERS" "DEVICE TYPES"
7 ui::divider 54
8 }
9
10 function ui::identity::row() {

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 function peers::list() {
2 local dir
3 dir="$(ctx::clients)"
4
5 if [[ -z "$(ls -A "$dir"/*.conf 2>/dev/null)" ]]; then
6 log::wg_list "No clients configured"
7 return 0
8 fi
9
10 for conf in "${dir}"/*.conf; do

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Client Config
5 # ============================================
6
7 function peers::create_client_config() {
8 local name="$1"
9 local type="$2"
10 local ip="$3"

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env bash
2
3 function cmd::inspect::on_load() {
4 flag::register --name
5 flag::register --type
6 flag::register --config
7 flag::register --qr
8 }
9
10 function cmd::inspect::help() {

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 months ago
1 #!/usr/bin/env python3
2 """
3 wgctl JSON helper — called by shell functions to read/write JSON files.
4 Usage: json_helper.py <command> <file> [key] [value]
5 """
6
7 import sys
8 import json
9 import os

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 --rule
10 flag::register --group
Newer Older

Powered by Opengist ⋅ Load: 120ms⋅

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