Commit graph

26 commits

Author SHA1 Message Date
Nuno Duque Nunes
b892298259 feat: accept logging, conntrack daemon, activity integration
- daemon/wgctl-conntrack: Go daemon for conntrack DESTROY events
- wgctl-conntrack.service: systemd service
- core/lib/accept_events.py: accept_events(), accept_aggregate()
- ctx::accept_events_log: .wgctl/daemon/accept_events.log
- activity: ACCEPT row with bytes in/out and conn count
- activity: accept dest rows with ↓/↑ bytes at end
- activity: --accept, --drop, --external flags
- activity: unified w_count for drop/accept alignment
- activity: drop service rows in red
- activity: accept dest rows in green
- sysctl: nf_conntrack_acct=1 for byte counting
- note: --exclude-service/--include-service deferred
2026-05-28 23:31:10 +00:00
Nuno Duque Nunes
0b9f113453 feat: block history tracking
- core/lib/block_history.py: record/unblock/list functions
- ctx::block_history: .wgctl/data/block-history/ path
- block --reason: record block event with reason, endpoint, triggered_by
- unblock --reason: update block event with unblock timestamp
- json::block_history_record/unblock/list/list_all wrappers
- json::endpoint_cache_get: get cached endpoint for peer
- export --all: include block-history in full backup
- import --all: restore block-history files
- tests: section_block_unblock with fixture peer, history field validation
2026-05-28 01:51:37 +00:00
Nuno Duque Nunes
79769667fb add json core functions 2026-05-27 23:08:21 +00:00
Nuno Duque Nunes
00d6be0766 add export,import features/add tests 2026-05-27 16:46:09 +00:00
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
a3fe7f5986 feat: command mixin system, --json output for list/inspect
- core/command_mixins.sh: mixin infrastructure with auto-loader
- core/mixins/json_output.mixin.sh: --json flag mixin
- core/mixins/no_color.mixin.sh: --no-color flag mixin
- commands/mixins/MIXIN_TEMPLATE.mixin.sh: template for new mixins
- command::run: reset mixin state, preprocess flags before dispatch
- command::_preprocess_flags: nameref-based flag stripping, empty array fix
- command::mixin: opt-in registration from on_load
- list --json: structured JSON output with envelope
- inspect --json: structured JSON peer detail output
- json::envelope, json::error_envelope helpers
2026-05-26 23:18:56 +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
d5de344d99 add ctx::endpoint_cache as arg to wrapper 2026-05-26 01:47:13 +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
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
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
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