gistfile1.txt
· 1.1 KiB · Text
Surowy
root@wireguard:/etc/wireguard/wgctl# sed -n '/dest_display/,/accept_dest_row/p' \
/etc/wireguard/wgctl/commands/activity.command.sh | head -20
local dest_display
local raw_suffix=""
local resolved="${_DEST_RESOLVE_CACHE[$spec]:-${d_ip}:${d_port}/${d_proto}}"
local dest_display="$resolved"
if [[ "$show_ports" == "true" && "$resolved" != "${d_ip}:"* && "$resolved" != "${d_ip} "* ]]; then
# Append dim raw IP:port — use printf to expand ANSI
dest_display=$(printf "%s \033[2m(%s:%s)\033[0m" "$resolved" "$d_ip" "$d_port")
fi
# If resolved AND --ports: append dim "(ip:port)"
if [[ "$show_ports" == "true" && "${_DEST_RESOLVE_CACHE[$spec]}" != "${d_ip}:"* ]]; then
dest_display+=" \033[2m(${d_ip}:${d_port})\033[0m"
fi
ui::activity::accept_dest_row \
"$dest_display" "$d_bytes_orig" "$d_bytes_reply" \
"$d_count" "$drops_col" "$w_count"
done
}
declare -gA _DEST_RESOLVE_CACHE=()
local -a _dest_specs=()
root@wireguard:/etc/wireguard/wgctl#
| 1 | root@wireguard:/etc/wireguard/wgctl# sed -n '/dest_display/,/accept_dest_row/p' \ |
| 2 | /etc/wireguard/wgctl/commands/activity.command.sh | head -20 |
| 3 | local dest_display |
| 4 | local raw_suffix="" |
| 5 | local resolved="${_DEST_RESOLVE_CACHE[$spec]:-${d_ip}:${d_port}/${d_proto}}" |
| 6 | local dest_display="$resolved" |
| 7 | if [[ "$show_ports" == "true" && "$resolved" != "${d_ip}:"* && "$resolved" != "${d_ip} "* ]]; then |
| 8 | # Append dim raw IP:port — use printf to expand ANSI |
| 9 | dest_display=$(printf "%s \033[2m(%s:%s)\033[0m" "$resolved" "$d_ip" "$d_port") |
| 10 | fi |
| 11 | # If resolved AND --ports: append dim "(ip:port)" |
| 12 | if [[ "$show_ports" == "true" && "${_DEST_RESOLVE_CACHE[$spec]}" != "${d_ip}:"* ]]; then |
| 13 | dest_display+=" \033[2m(${d_ip}:${d_port})\033[0m" |
| 14 | fi |
| 15 | ui::activity::accept_dest_row \ |
| 16 | "$dest_display" "$d_bytes_orig" "$d_bytes_reply" \ |
| 17 | "$d_count" "$drops_col" "$w_count" |
| 18 | done |
| 19 | } |
| 20 | |
| 21 | declare -gA _DEST_RESOLVE_CACHE=() |
| 22 | local -a _dest_specs=() |
| 23 | root@wireguard:/etc/wireguard/wgctl# |
| 24 |