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 5 months ago
1 function cmd::group::rm_peers() {
2 local name="" force=false
3
4 while [[ $# -gt 0 ]]; do
5 case "$1" in
6 --name) util::require_flag "--name" "${2:-}" || return 1; name="$2"; shift 2 ;;
7 --force) force=true; shift ;;
8 --help) cmd::group::help; return ;;
9 *) log::error "Unknown flag: $1"; return 1 ;;
10 esac

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 def poll_handshakes():
2 """
3 Poll wg show latest-handshakes periodically.
4 Log a handshake event only when gap > WG_HANDSHAKE_CHECK_SEC (new session).
5 """
6 global _hs_last_logged
7
8 _hs_last_logged = load_hs_cache()
9
10 pubkey_to_name = build_pubkey_to_name()

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 ────────────────────────────────────────────────
2 wgctl — Live Monitor (Ctrl+C to stop)
3 ────────────────────────────────────────────────
4
5 09:56 phone-helena — handshake
6 12:04 laptop-nuno — handshake
7 14:45 desktop-zephyr — handshake
8 14:45 desktop-zephyr 86.120.152.74 handshake
9 14:44 phone-helena 148.69.46.73 → helena-wan handshake
10 12:20 laptop-nuno 94.63.0.129 → nuno-home handshake

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 ────────────────────────────────────────────────
2 wgctl — Live Monitor (Ctrl+C to stop)
3 ────────────────────────────────────────────────
4
5 08:18 phone-helena — handshake
6 12:04 laptop-nuno — handshake
7 14:37 phone-helena 148.69.46.73 handshake
8 12:20 laptop-nuno 94.63.0.129 handshake
9 06:22 phone-helena-2 148.69.203.225 handshake
10 05:15 desktop-zephyr 86.120.152.74 handshake

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 # ui::_render_endpoint_col
2 # Builds padded endpoint string: "raw_ip → resolved" or "raw_ip" or "-"
3 # Args: endpoint resolved w_endpoint
4 # Returns: padded colored string via stdout
5 function ui::_render_endpoint_col() {
6 local endpoint="${1:-}" resolved="${2:-}" w_endpoint="${3:-20}"
7 local colored visible_len pad_n
8
9 if [[ -n "$endpoint" ]]; then
10 if [[ -n "$resolved" ]]; then

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 #!/usr/bin/env bash
2 # modules/resolve.module.sh — IP/host resolution chain
3 # Chains: hosts.json exact match → services.json match → raw IP
4 # Depends on: hosts.module.sh, net.module.sh
5
6 declare -gA _RESOLVE_CACHE=()
7
8 # resolve::ip <ip> [port] [proto]
9 # Resolves an IP to a display name using the full resolution chain.
10 # Returns raw IP if no match found.

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1
2 local endpoint_display
3 endpoint_display=$(resolve::ip "${endpoint:-}")
4 [[ -z "$endpoint_display" ]] && endpoint_display="${endpoint:--}"
5
6 # Build row with ts prefix for sorting
7 local row
8 row=$(ui::watch::wg_row "$ts_fmt" "$client_name" "$endpoint_display" "handshake" \
9 "$w_client" "$w_dest")
10 rows+=("${ts}|${row}")

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 function ui::watch::fw_row() {
2 local ts="${1:-}" client="${2:-}" dest_display="${3:-}" \
3 w_client="${4:-20}" w_dest="${5:-18}"
4
5 # "fw" is always 2 visible chars — no padding needed
6 local src="${_UI_WATCH_FW_COLOR}fw\033[0m"
7
8 local ts_pad client_pad dest_pad_n
9 ts_pad=$(printf "%-11s" "$ts")
10 client_pad=$(printf "%-${w_client}s" "$client")

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 function cmd::identity::help() {
2 cat <<EOF
3 Usage: wgctl identity <subcommand> [options]
4
5 Manage peer identities.
6
7 Subcommands:
8 list List all identities
9 show --name <name> Show identity details and device status
10 add --name <name> Manually attach a peer to an identity

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 5 months ago
1 #!/usr/bin/env bash
2
3 # ============================================
4 # Private helpers
5 # ============================================
6
7 function cmd::shell::_prompt() {
8 local user host dir
9 user=$(whoami)
10 host=$(hostname -s)
Newer Older

Powered by Opengist ⋅ Load: 96ms⋅

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