14 Commits

Author SHA1 Message Date
maksarsanjeev 46901f2b62 Net: 8 s health-check timeout, show a dead proxy only after two misses
AmneziaWG 3 tunnels idle for a while need 5+ s for the first handshake, so the
4-5 s checks marked working connections as dead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:31:03 +03:00
maksarsanjeev 3c7931d710 Net core: accept Amnezia keys that carry a plain AmneziaWG .conf
Newer Amnezia apps share vpn:// keys whose payload (same base64url + length + zlib
wrapping) is an AmneziaWG .conf ([Interface]/[Peer], AWG 3 fields) instead of the JSON
containers; the parser failed with «Expecting value: line 1 column 2». decode_key()
handles both; --check and the provider build use it. Tested with mihomo -t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 11:19:25 +03:00
maksarsanjeev cd119d3b8f Net core: clean restart when the Mac changes networks, instead of a leaky rebind
Re-creating the WireGuard tunnels through a provider reload leaked every old tunnel: on
16.10 the core held 652 UDP sockets to the Amnezia servers and 677 MB, and the servers
stopped answering the handshake flood. netctl rebind is now a clean core restart (the
move drops the TCP connections anyway), and BroV calls it only when the IPv4 address of
a physical adapter actually changed, not on every path update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 02:08:51 +03:00
maksarsanjeev f32397ea34 Net core: DNS goes into the core only on the active adapter
netctl pointed every network service at 198.18.0.2, «iPhone USB», Thunderbolt Bridge and
VPN services included; macOS then kept re-checking them and offered the iPhone's hotspot
over and over. Now only hardware services (en*) with an active link are changed, and a
service an older version changed is given its DNS back. rebind (on every network change)
also moves the DNS to a newly active adapter while capture is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 16:22:19 +03:00
maksarsanjeev 101a3860a9 Net core: re-create WireGuard tunnels after a network change (rebind)
mihomo's WireGuard outbounds keep their UDP socket bound to the address they started on:
after moving from Planet9 to Saga the Amnezia sockets were still sending from
192.168.68.x, so every Amnezia (and client) tunnel looked dead while the AmneziaVPN app,
connecting afresh, worked. Client tunnels now live in a file provider (keys/clients.yaml,
groups select them by filter) like the Amnezia keys; netctl rebind touches both files and
reloads the providers, which re-creates the tunnels on the current address without
touching other connections. BroV calls it on every network change before re-testing.
Tested on a scratch core: groups, selection across a rebind, health check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:54:16 +03:00
maksarsanjeev 0586b3c7e9 Net core: subscription fetched through the exit, hourly, and on demand
The cluster subscription host is unreachable directly from home: the provider pull had
failed with EOF since day one and the node list went stale (a new node, Aurora, never
showed up). The provider now downloads through «exit», every hour instead of 12, and
netctl refresh (BroV: «Обновить список узлов») pulls it now and reports added/removed
nodes, without a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:36:05 +03:00
maksarsanjeev b11d778b04 Net core: add single vless:// keys from BroV
- add_key accepts a vless:// link (uuid, host, port, Reality pbk checked; duplicates
  refused; the name from #fragment, made unique). Stored in keys/vless.txt (root, 600),
  served as the file provider vless-keys, which joins «ai-out» and «Авто» and the hide
  filter. The first key reloads the core (the provider appears), later ones only reload
  the provider. state reports vless-keys delays.
- BroV: «Добавить подключение» takes vpn:// or vless://.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:20:49 +03:00
maksarsanjeev 817c837f5a Net core: with capture on, the Mac's DNS goes into the core
The home router's DNS (192.168.10.1) doesn't answer; a LAN DNS server is reached around
the TUN, so with AmneziaVPN off nothing resolved. netctl now points every network service
at 198.18.0.2 (hijacked inside the TUN) when capture is on, restores the previous servers
when it goes off, and syncs this at boot. uninstall.sh puts DNS back too.
Adds scripts/netcore/diag.sh (one-minute TUN diagnosis, run by hand with sudo).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:25:54 +03:00
maksarsanjeev 3077404ebf Net core: turning capture on restarts the core cleanly; remember TUN state
After the AmneziaVPN app held the routes, the running core kept Amnezia's utun as its
way out; its own TUN reused the same utun name and sent everything into itself (no
routes, no DNS). "tun on" now refuses while AmneziaVPN is open and restarts the core;
the on/off choice is saved (tun.json) and used on the next start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 00:11:54 +03:00
maksarsanjeev bc548d748c Ignore __pycache__
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 23:25:55 +03:00
maksarsanjeev 422c538df6 Terminal: drop files / paperclip; net core: fallback exit, re-test on network change, hide/unhide connections
- term.macOS: dropping files over an open terminal or the paperclip types their
  shell-escaped paths (bracketed paste when the program asks for it).
- Traffic now goes through a fallback group "exit": the pick while it answers,
  "auto" when it doesn't. A pinned connection that dies no longer cuts the Mac off.
- Faster checks (exit 30 s, auto 60 s, 3 failures trigger a re-test) and a re-test
  of every group 4 s after any network change (Wi-Fi switch, sleep, AmneziaVPN).
- hide/unhide instead of deleting keys: Amnezia connections and VLESS nodes leave the
  list and "auto"; kept on disk, returned from "Убранные".
- Core logs are owner-only (they can contain the subscription URL).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 23:25:47 +03:00
maksarsanjeev 9e02402555 install.sh: wait for both services before reporting (no false alarm)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 01:40:42 +03:00
maksarsanjeev a7a0195d34 Network core: home WireGuard as a client network (off = direct at home, on = via home tunnel when away); drop Saga's overlapping 10.0.0.0/24 tunnel subnet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 01:31:14 +03:00
maksarsanjeev 52e1e8288b Security + upstream fixes
- Network core moves to a root-only folder; BroV talks to a narrow root helper (netctl.py) over a user-only socket; install script verifies the mihomo SHA256 and migrates keys (scripts/netcore)
- Hardened runtime, no get-task-allow; bypassPermissions removed from the chat; concealed clipboard items are not restored; DangerCheck knows core, LaunchAgents and hook paths; dropped-file copies expire after 7 days
- Ported from upstream Coucou: 1h crash fix (d05f22b), safe settings.json writes (918d30e), Escape/fold for pending approvals (6012900, 40e3ba8), auto-close delay + reopen (74984f2, ea244a7), full AskUserQuestion (52b1562)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 23:49:11 +03:00