Commit graph

27 commits

Author SHA1 Message Date
Nuno Duque Nunes
2a6648735e refactor: config restructure, wgctl.json, data/ directory layout
- context.sh: .wgctl/{config,data,daemon} directory structure
- ctx::config_file: points to .wgctl/config/wgctl.json
- ctx::data: points to .wgctl/data/ (rules, identities, groups, etc.)
- ctx::peer_history: .wgctl/data/peer-history/
- config.module.sh: loads from wgctl.json via json::config_load
- config::_load_legacy: fallback for old wgctl.conf with migration warning
- json_helper.py: config_load() outputs KEY=value pairs from wgctl.json
- cmd::config::migrate: converts wgctl.conf → wgctl.json, moves data files
- cmd::config::_show: renamed from run body
- daemon/wgctl-monitor.py: updated PEER_HISTORY_DIR path
2026-05-27 01:37:28 +00:00
Nuno Duque Nunes
8b47e55b4a feat: peer endpoint history tracking and resolution
- daemon: update_peer_history() tracks all endpoints per peer
- daemon: endpoint_index.json for O(1) IP -> peer name lookup
- daemon: poll_handshakes updates history on every cycle
- json_helper: peer_history_lookup() uses index, falls back to scan
- resolve::endpoint_parts: step 3 checks peer history index
- json.sh: json::peer_history_lookup wrapper
- resolve: mobile peer IPs now resolve to peer name via history
2026-05-26 15:51:53 +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
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
8b1f4e48c1 fix block_is_empty missing in dict 2026-05-25 14:07:26 +00:00
Nuno Duque Nunes
1308f9e07a refactor: split json_helper.py into lib/ modules
- core/lib/util.py: shared utilities, ip_to_name, reverse_lookup, parse_since
- core/lib/events.py: fw_events, wg_events, follow_logs, event parsers
- core/lib/peers.py: peer_data, peer_transfer, peer_transfer_delta
- core/lib/activity.py: activity_aggregate
- json_helper.py: thin dispatcher importing from lib/
- events.py: --since, --filter-event, --filter-dest-ip/port query flags
- util.py: parse_since supporting relative (2h/7d) and EU/ISO date formats
2026-05-24 22:02:50 +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
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
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
abf4cd7e1c feat: wgctl activity command — transfer totals and firewall drops per peer 2026-05-22 20:28:55 +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
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
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
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
0efa6c3a9e feat: date format config, batch optimizations, list refactor, fw:: rename, .wgctl data dir 2026-05-11 22:27:33 +00:00