From e8c3e82a1a375a3d7b30a7bba13a21fa565be770 Mon Sep 17 00:00:00 2001 From: datadunia Date: Fri, 15 May 2026 23:09:25 +0700 Subject: [PATCH] refactor: update submodules to internal module paths --- .../plans/nxg-phase-4.5-production-ready.md | 29 ++++++++++ .sisyphus/plans/nxg-phase6-desktop-client.md | 55 +++++++++++++++++++ apps/device-agent | 2 +- apps/server-core | 2 +- 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 .sisyphus/plans/nxg-phase-4.5-production-ready.md create mode 100644 .sisyphus/plans/nxg-phase6-desktop-client.md diff --git a/.sisyphus/plans/nxg-phase-4.5-production-ready.md b/.sisyphus/plans/nxg-phase-4.5-production-ready.md new file mode 100644 index 0000000..63c5f49 --- /dev/null +++ b/.sisyphus/plans/nxg-phase-4.5-production-ready.md @@ -0,0 +1,29 @@ +# NexusGuard SD-WAN — Phase 4.5: Multi-Node Architecture & Production Readiness + +**Goal**: Transform the system from a single-node mockup into a true Multi-Server (WGDashboard-style) architecture, and harden the database startup mechanisms for production environments. + +## Task 4.5.1: Multi-Server Database & API +- **Files**: `models.go`, `001_init.sql`, `api/servers.go`, `main.go` +- **Actions**: + - Add `WgServerID` foreign key to the `Device` model. + - Implement full CRUD REST API for `WgServer` (`/api/v1/servers`) to allow Admin to register multiple public WireGuard nodes. + +## Task 4.5.2: Provisioning API Multi-Node Fix +- **Files**: `api/provisioning.go`, `api/provisioning_test.go` +- **Actions**: + - Remove the hardcoded `127.0.0.1:51820` fallback. + - During provisioning, fetch the exact `WgServer` related to the device. + - Return the true `Endpoint` and `PublicKey` of that specific node to the connecting agent. + +## Task 4.5.3: Dashboard UI - Nodes Management +- **Files**: `src/views/Servers.vue`, `src/views/Devices.vue`, `src/api/servers.ts`, `src/App.vue` +- **Actions**: + - Build the "Nodes" page to manage external WireGuard servers. + - Update the "Add Device" form to include a required dropdown where the Admin selects which Node the device will connect to. + - Update the Sidebar to reflect the new navigation. + +## Task 4.5.4: Production Readiness (Install Detection) +- **Files**: `main.go` +- **Actions**: + - Add logic to verify if the DB is empty on startup. + - Add `-migrate-prod` flag that uses the `goose` library to apply `001_init.sql` automatically in production without needing AutoMigrate. diff --git a/.sisyphus/plans/nxg-phase6-desktop-client.md b/.sisyphus/plans/nxg-phase6-desktop-client.md new file mode 100644 index 0000000..120f5a2 --- /dev/null +++ b/.sisyphus/plans/nxg-phase6-desktop-client.md @@ -0,0 +1,55 @@ +# NexusGuard SD-WAN — Phase 6: Desktop Client GUI + +## Overview +This plan extends the NexusGuard architecture to include a User-Friendly Desktop VPN Application for Windows and Linux users. It transitions the `sys-bridge` agent from a "stealth daemon" into a managed sidecar process controlled by a visual GUI. + +## Architecture Decisions +- **Framework**: Tauri (Rust) for minimal RAM overhead and native OS integration. +- **Frontend**: Vue 3 + TailwindCSS (Glassmorphism theme) to match the Dashboard UI. +- **Engine**: The Go binary (`sys-bridge`) built in Phase 2 will be bundled as a **Tauri Sidecar**. Tauri will spawn and control the Go binary. +- **Privilege Elevation**: The Tauri app must prompt for Admin/Root access on startup because WireGuard/Wintun requires elevated privileges to create network adapters. + +## Task 6.1: Tauri + Vue 3 Scaffold +- **Goal**: Initialize the project structure in `apps/desktop-client`. +- **Actions**: + - Run `create-tauri-app` using Vue 3 and TypeScript. + - Install Tailwind CSS v4 and matching UI dependencies (HeroIcons, Pinia). + - Configure `tauri.conf.json` to allow elevated execution (`requireAdministrator` manifest on Windows). + +## Task 6.2: Sidecar Integration (Go Binary) +- **Goal**: Bundle the `sys-bridge` agent. +- **Actions**: + - Modify the Phase 2 `sys-bridge` binary to support a `--json` output flag for machine-readable logs. + - Configure Tauri `externalBin` to package `sys-bridge-x86_64-pc-windows-msvc.exe` and `sys-bridge-x86_64-unknown-linux-gnu`. + - Write Rust command `start_tunnel(token: String)` that spawns the sidecar process and pipes stdout to the Vue frontend. + +## Task 6.3: UI - Registration State +- **Goal**: Build the first-time setup screen. +- **Actions**: + - UI detects if `REG_TOKEN` is saved locally. + - If missing, display a futuristic input form: "Link Device to NexusGuard". + - User pastes the Token from the Dashboard. + - Validate token format and securely store it using Tauri API (`tauri-plugin-store`). + +## Task 6.4: UI - Connected State & Telemetry +- **Goal**: Build the active VPN dashboard. +- **Actions**: + - Large glowing "CONNECT / DISCONNECT" toggle button. + - Read output from the Go sidecar to determine Tunnel State (Connecting, Handshake Successful, Error). + - Display current `InternalIP` and connection uptime. + - Traffic graph (Tx/Rx bytes) updated in real-time. + +## Task 6.5: OS Integration & Wintun Setup (Windows) +- **Goal**: Ensure seamless Windows networking. +- **Actions**: + - Automatically download or bundle `wintun.dll`. + - Register the application in the System Tray (Tauri system tray API). + - Allow running in the background when the window is closed. + +--- +**Exit Criteria**: +- [ ] Tauri app compiles for Windows (`.msi` / `.exe`) +- [ ] App prompts for Admin rights on launch +- [ ] User can input Registration Token in GUI +- [ ] Clicking "Connect" successfully spawns the Go sidecar and establishes the WireGuard tunnel +- [ ] System Tray icon shows connection status diff --git a/apps/device-agent b/apps/device-agent index 60ca014..05b65fd 160000 --- a/apps/device-agent +++ b/apps/device-agent @@ -1 +1 @@ -Subproject commit 60ca0145389b53186eb92f958b7fff27caf526ad +Subproject commit 05b65fdc8a15320f607b3929c9dcd2545802dd63 diff --git a/apps/server-core b/apps/server-core index b99af3a..5bda512 160000 --- a/apps/server-core +++ b/apps/server-core @@ -1 +1 @@ -Subproject commit b99af3a316679de4802f01622f94efc09b7c6d40 +Subproject commit 5bda512e054fd3c8e796c006d2202fd02ded5cf3