Commit graph

46 commits

Author SHA1 Message Date
Nuno Duque Nunes
adab623f3f feat: group purge-stale, peer endpoint history, resolve improvements
- group purge-stale: remove stale peers from group(s), --all, --dry-run
- daemon: update_peer_history() tracks all endpoints per peer
- daemon: endpoint_index.json for O(1) IP -> peer name lookup
- json_helper: peer_history_lookup() with index + scan fallback
- resolve::endpoint_parts: peer history as step 3 in resolution chain
- resolve::service_name: returns service name only, no raw fallback
- resolve::endpoint_parts: removed stale cache, always fresh
- watch: ui::wg_row/fw_row use shared primitives
- ui: ui::_render_endpoint_col, ui::_build_dest shared primitives
- shell: peer/hosts/identity/subnet/policy/activity in known commands
2026-05-26 20:51:40 +00:00
Nuno Duque Nunes
c3cf5bc572 feat: watch/logs endpoint annotation, shared row primitives
- ui::_render_endpoint_col: shared endpoint padding primitive
- ui::_build_dest: shared destination display primitive
- ui::wg_row/fw_row: endpoint annotation (raw_ip → resolved)
- resolve::endpoint_parts: fresh resolution, no stale cache
- resolve::service_name: returns service name or empty (no raw fallback)
- monitor::live: pre-measure w_client from peer names
- watch: fixed w_endpoint=30 for consistent live alignment
- shell: add peer/hosts/identity/subnet/policy/activity to known commands
- shell: updated banner with new commands
- identity/rule help: updated with new features
2026-05-26 15:16:33 +00:00
Nuno Duque Nunes
c6883c6801 fix: --ascending/--descending flag parsing in logs show
- cmd::logs::show: parse --ascending and --descending flags
- sort_order defaults to desc
2026-05-26 12:40:35 +00:00
Nuno Duque Nunes
7120199004 feat: logs --resolved flag, logs clean, performance improvements
- logs --resolved: show only resolved names, hide raw IPs
- logs clean: remove keepalive handshakes via json::clean_handshakes
- batch_resolve: single Python call for all endpoint resolutions
- fw_row/wg_row: native bash padding replaces ui::pad_mb (5x speedup)
- fw_row/wg_row: correct arrow byte counting (→ = 3 bytes, 1 visible)
- help: updated with new subcommands and flags
- on_load: --resolved, --ascending, --descending registered
2026-05-26 04:34:39 +00:00
Nuno Duque Nunes
fb33aa1b6d feat: logs endpoint annotation, alignment, descending sort
- fw/wg events: raw_ip → resolved_name annotation (dim)
- fw events: endpoint column with pre-resolved names (two-pass render)
- fw events: raw IP:port dim suffix after service name
- wg events: endpoint annotation in logs (same as watch)
- fw/wg: descending sort default, --ascending/--descending flags
- wg events: gap/offline indicator, threshold * 2 for offline label
- fw_row: no-endpoint rows show dim — placeholder for alignment
- section headers: dynamic width via tput cols
2026-05-26 03:07:57 +00:00
Nuno Duque Nunes
3c3f870427 feat: logs descending sort, gap/offline indicator, endpoint resolution
- wg_events: sort_order param (desc default), --ascending/--descending flags
- wg_events: endpoint cache fallback via _endpoint() helper
- wg_events: gap computed ascending always, then sliced/reversed correctly
- fw_events: sort_order param, descending default
- ui::logs::wg_row: gap suffix with 'offline' label when gap > threshold
- logs.command.sh: --ascending/--descending flags, pass sort_order to both functions
- daemon: endpoint cache fallback in poll_handshakes
- json.sh: json::wg_events passes ctx::endpoint_cache as arg
2026-05-26 01:34:48 +00:00
Nuno Duque Nunes
cf71e9f51a test: add tests for all new features, fix bugs found by tests
- integration: logs query flags, hosts command, peer command sections
- unit: fmt::bytes, config::dns_string, parse_since, ui::group::status
- destructive: duplicate rule validation, peer update-dns/tunnel
- fix: config::allowed_ips_for used $2 instead of $1
- fix: identity rule assign exit_code unbound variable
- fix: ctx::identity → ctx::identities in peers::get_identity
- fix: peers::get_identity restored (needed for rule assign duplicate check)
- rule assign: blocks if rule already in peer's identity via peers::get_identity
- identity rule assign: --migrate removes conflicting direct peer rules
2026-05-26 00:09:30 +00:00
Nuno Duque Nunes
794e75bc9b feat: duplicate rule validation, peer command, fallback DNS
- rule assign: block if rule already in peer's identity
- identity rule assign: --migrate flag to remove conflicting direct peer rules
- commands/peer.command.sh: update-dns and update-tunnel subcommands
- config.sh: config::dns_fallback, config::dns_string
- peers.module.sh: peers::get_display_subnet extraction
- wgctl peer update-dns --all: retrofits existing peer configs with fallback DNS
- wgctl.conf: WG_DNS_FALLBACK support
2026-05-25 21:39:17 +00:00
Nuno Duque Nunes
a003e3b753 fix: policy_read accidental defaults merge from module split
- _policy_read: remove erroneous _POLICY_DEFAULTS merge (introduced during split)
- fmt.sh: fmt::bytes extracted from cmd::activity::_fmt_bytes
- identity/subnet/policy list: ui::sort_rows applied
- ctx::policies moved from policy.module.sh to context.sh
2026-05-25 18:45:23 +00:00
Nuno Duque Nunes
86220850c1 fix: handshake session detection, endpoint cache, watch ordering
- wgctl-monitor: update _hs_last_logged on ALL handshakes not just new sessions
- wgctl-monitor: fix endpoint_cache.json absolute path
- wgctl-monitor: move script to wgctl/daemon/ (correct location)
- watch: _poll_handshakes sorts by ts descending, endpoint cache fallback
- watch: empty endpoint uses - not em dash (alignment fix)
- logs: newline between fw and wg sections
- monitor::live extracted, cmd::logs::follow no longer calls cmd::run
- ui.sh: UTF-8 extra byte constants
2026-05-25 16:19:13 +00:00
Nuno Duque Nunes
3058750c3d cleanup: ui::pad_mb removal, watch alignment fixes, endpoint cache fallback
- ui::rule::list_row: inline padding math replaces ui::pad_mb (major perf gain)
- ui::fw_row/wg_row: drop ui::pad_mb for fw/wg labels (always 2 chars)
- watch: endpoint fallback via monitor::get_cached_endpoint
- watch: _poll_handshakes sorts by ts descending (most recent first)
- watch: empty endpoint uses - not — (avoids multi-byte padding issues)
- ui.sh: UTF-8 extra byte constants (_UI_EMDASH_EXTRA, _UI_ARROW_EXTRA, _UI_BULLET_EXTRA)
2026-05-25 15:09:13 +00:00
Nuno Duque Nunes
3378ec3e5e feat: logs query flags, json_helper module split, handshake logging
- wgctl logs --since: relative (2h/7d) and EU/ISO date formats
- wgctl logs --service: filter by service name, IP, or IP:port
- wgctl logs --event: filter wg events by type
- wgctl logs: no header when no logs found
- core/lib/util.py: shared utilities, parse_since, reverse_lookup
- core/lib/events.py: fw_events, wg_events with query params
- core/lib/peers.py: peer_data, peer_transfer
- core/lib/activity.py: activity_aggregate
- wgctl-monitor.py: handshake session poller thread with cache
2026-05-25 00:21:16 +00:00
Nuno Duque Nunes
28ee56aeff feat: identity show with rule tree, peer dimming, net/group tableless layouts
- identity show: peers, rules tree, dim offline peers
- ui::rule::identity_block --no-header flag with reduced indentation
- ui::identity::device_row: index suffix fix, offline dimming
- net list/show: tableless with port display and descriptions
- group list/show: tableless with status coloring, stale peer handling
- group list_data: filter stale peers via clients_dir
- logs: hourly collapse for attempts, --detailed for raw events
- hosts resolution in wg_events static view
- wg-quick PostDown iptables error fix (2>/dev/null)
2026-05-24 20:46:02 +00:00
Nuno Duque Nunes
a71f7a0dd9 fix fw logs not showing, add hourly structuring to logs 2026-05-24 02:13:06 +00:00
Nuno Duque Nunes
689908c875 refactor: tableless design for net, group list | net, group show 2026-05-24 00:08:15 +00:00
Nuno Duque Nunes
b813810ff3 feat: hosts.json IP resolution system
- wgctl hosts command (list, show, add, rm) with tags support
- modules/resolve.module.sh — chain: hosts.json → services.json → raw IP
- modules/hosts.module.sh — hosts::resolve_ip, hosts::lookup_ip
- resolve::ip and resolve::dest used in watch, logs, activity
- _WGCTL_RAW=true via --raw flag bypasses all resolution
- json_helper.py: hosts_list, hosts_show, hosts_add, hosts_remove, hosts_lookup
2026-05-23 22:01:45 +00:00
Nuno Duque Nunes
560e4cbe09 feat: peer list row coloring, verbose status, dim offline rows
- Dim gray for offline peers — lights off visual
- Dim/bold red for blocked peers (offline/online)
- Dim/bold yellow for restricted peers (offline/online)
- online (blocked) / offline (blocked) verbose status
- LIST_VERBOSE_STATUS=false to revert to simple status
- Rule list: +0/-0 dimmed, 0 peers dimmed
- Summary includes group breakdown
2026-05-23 04:51:33 +00:00
Nuno Duque Nunes
4dcf98b128 feat: tableless logs/watch layout with service annotations
- wgctl logs: tableless layout, fw/wg sections, --merged flag, --raw flag
- wgctl watch: tableless layout, service annotations, colored fw/wg labels
- wgctl rule list: tableless with +N/-N/+all indicators, inline extends
- wgctl activity: transfer totals and firewall drops per peer
- ui/logs.module.sh: fw_row, wg_row, watch rows, table versions kept
- ui/rule.module.sh: list_row, list_group_header, list_base_header
- fmt.sh: FMT_DATETIME_SHORT, updated fmt::set_date_format
- json_helper.py: fw_events with service annotation, wg_events with count
2026-05-23 03:24:20 +00:00
Nuno Duque Nunes
57e08e88c4 feat: rule list tableless layout with inline extends and +all/-N indicators 2026-05-22 23:12:27 +00:00
Nuno Duque Nunes
abf4cd7e1c feat: wgctl activity command — transfer totals and firewall drops per peer 2026-05-22 20:28:55 +00:00
Nuno Duque Nunes
15897203a5 fix: blocked peer color, last seen annotation, subnet display in detailed view 2026-05-22 16:46:41 +00:00
Nuno Duque Nunes
4b2f2a846a feat: identity, subnet, policy systems + tableless layouts 2026-05-22 03:42:40 +00:00
Nuno Duque Nunes
92d829e184 implement policy system 2026-05-21 02:16:32 +00:00
Nuno Duque Nunes
de1a44a7e4 finish base implementation 2026-05-20 21:49:44 +00:00
Nuno Duque Nunes
8bb1de4976 init feature 2026-05-19 15:26:31 +00:00
Nuno Duque Nunes
4ac25e283d cleanup structure,bak files | change peers header to match fw in rule inspect 2026-05-19 01:17:20 +00:00
Nuno Duque Nunes
7323bf20f1 feat: main group display, group::has_peer, config validation, full block cleanup on unblock, ui::empty helper, blocks header count 2026-05-17 22:06:21 +00:00
Nuno Duque Nunes
87f6c770ef add README 2026-05-16 21:41:38 +00:00
Nuno Duque Nunes
f32ca5c0a1 feat: complete wgctl v2 — net services, block system M:N, rule inheritance, service annotations, restricted status, 64 tests passing 2026-05-15 12:36:38 +00:00
Nuno Duque Nunes
16b4351313 feat: block/unblock --service, fw::has_rule wrappers, restricted status, net annotations, block system tests, 64 tests passing 2026-05-15 11:36:05 +00:00
Nuno Duque Nunes
c1d0a9ddd4 feat: block/unblock --service, fw::has_rule/has_block_rule/has_allow_rule, block::cleanup, restricted status in inspect, net service annotations 2026-05-15 09:22:17 +00:00
Nuno Duque Nunes
9a3ac2ae47 feat: net command, service annotations, block::restore_rules_for, fw refactor, restricted status, block system cleanup 2026-05-15 08:04:06 +00:00
Nuno Duque Nunes
cf90ab22db feat: block system JSON migration, M:N group tracking, block module, block::restore_all, color module, fw refactor 2026-05-15 04:44:53 +00:00
Nuno Duque Nunes
7b32dcfebc feat: rule inheritance, rule groups, rule show/inspect redesign, rule add/update --extends --group, list filters 2026-05-14 02:10:50 +00:00
Nuno Duque Nunes
6ac1a7d3a2 feat: rule inheritance, rule groups, rule inspect, ui::center, fw dedup, activity metrics 2026-05-13 22:44:07 +00:00
Nuno Duque Nunes
a09c59a7c4 fix: iptables rule ordering, idempotent fw functions, rule module cleanup, variable leak fixes 2026-05-13 04:14:30 +00:00
Nuno Duque Nunes
8ef8ea91b3 feat: group watch with peer filter, watch --peers flag, watch command cleanup 2026-05-13 02:00:08 +00:00
Nuno Duque Nunes
b1bca613de feat: fw --rule filter, fw help, updated wgctl help, shell banner 2026-05-13 00:41:16 +00:00
Nuno Duque Nunes
a7fd62ce32 refactor: group::each_peer helper, peer existence checks, group remove cleanup, watch multi-peer filter 2026-05-13 00:06:34 +00:00
Nuno Duque Nunes
51e3443357 refactor: rule::show new layout, assign fix, unblock helpers, test improvements 2026-05-12 04:27:47 +00:00
Nuno Duque Nunes
5702b118b0 refactor: remove/rename helpers, test --fn mode, param defaults, WGCTL_BINARY 2026-05-12 01:43:43 +00:00
Nuno Duque Nunes
b3a9c69cab refactor: block::run helpers, test --fn mode, param defaults 2026-05-12 01:21:25 +00:00
Nuno Duque Nunes
8ca3669c6c refactor: test suite improvements, peers::get_type, dead code removal, add::run helpers, ui::col_width attempt 2026-05-12 00:49:12 +00:00
Nuno Duque Nunes
312f1f973c feat: test suite, date formatter, list optimizations, fw:: rename, config overrides 2026-05-11 23:42:44 +00:00
Nuno Duque Nunes
0efa6c3a9e feat: date format config, batch optimizations, list refactor, fw:: rename, .wgctl data dir 2026-05-11 22:27:33 +00:00
root
78f9caaf17 add wgctl 2026-05-06 23:02:12 +00:00