114 lines
5.1 KiB
Markdown
114 lines
5.1 KiB
Markdown
Ini adalah pembagian **3 Repositori Terpisah** untuk sistem **NexusGuard**. Dengan pembagian ini, divisi Backend, Frontend/Mobile, dan Embedded/System dapat bekerja secara paralel tanpa saling tunggu (decoupled).
|
|
|
|
---
|
|
|
|
### **Repo 1: `nexus-server-core` (Divisi Backend & Network)**
|
|
Repositori ini adalah otak sistem yang mengelola database, API, dan perintah firewall (nftables).
|
|
|
|
* **Tech Stack:** Go (Gin), PostgreSQL, Redis, `google/nftables`.
|
|
* **Tugas Utama:**
|
|
* Menyediakan API untuk Dashboard dan Agent.
|
|
* Mengelola **IPAM** (pembagian IP 10.x.x.x).
|
|
* **Network Enforcer:** Manipulasi `nftables` (sets & vmaps) untuk isolasi Zero Trust.
|
|
* **STUN Signaling:** Koordinasi IP publik untuk UDP Hole Punching.
|
|
* **Struktur Folder:**
|
|
```text
|
|
├── api/ # REST API Handlers
|
|
├── internal/
|
|
│ ├── firewall/ # nftables Controller logic
|
|
│ ├── coordinator/ # STUN & P2P Logic
|
|
│ └── models/ # GORM Models (User, Device, Rule)
|
|
├── docs/
|
|
│ └── API_SPEC.md # KONTRAK API (Penting untuk migrasi ke PHP)
|
|
└── main.go
|
|
```
|
|
|
|
---
|
|
|
|
### **Repo 2: `nexus-dashboard-ui` (Divisi Frontend & Mobile)**
|
|
Repositori ini adalah antarmuka untuk pengguna akhir dan administrator.
|
|
|
|
* **Tech Stack:** Vue.js 3, Vite, Pinia, Capacitor.js.
|
|
* **Tugas Utama:**
|
|
* Manajemen akun user dan registrasi perangkat.
|
|
* Visualisasi status perangkat (Online/Offline) secara real-time.
|
|
* Konfigurasi Firewall (Allow Internet, Port Forwarding, Peer Access).
|
|
* Build ke **Web** dan **Android APK** (via Capacitor).
|
|
* **Struktur Folder:**
|
|
```text
|
|
├── src/
|
|
│ ├── api/ # Service untuk konsumsi API Repo 1
|
|
│ ├── views/ # Halaman Management & Monitoring
|
|
│ └── store/ # State management (auth, device list)
|
|
├── capacitor.config.ts # Config untuk Android/iOS
|
|
├── android/ # Project Native Android
|
|
└── package.json
|
|
```
|
|
|
|
---
|
|
|
|
### **Repo 3: `nexus-device-agent` (Divisi System/Embedded)**
|
|
Repositori ini adalah aplikasi yang akan diinstal di perangkat (CCTV, Server, IoT).
|
|
|
|
* **Tech Stack:** Go (Static Binary), `wireguard-go` (library), `crypto/aes`.
|
|
* **Tugas Utama:**
|
|
* **Stealth Tunneling:** Menjalankan WireGuard di dalam memori tanpa file config.
|
|
* **Hardware Fingerprinting:** Mengunci perangkat berdasarkan HWID unik.
|
|
* **Key Rotation:** Melakukan rotasi kunci otomatis sesuai instruksi Repo 1.
|
|
* **Auto-Healing:** Mencoba reconnect otomatis jika jalur UDP terblokir.
|
|
* **Struktur Folder:**
|
|
```text
|
|
├── internal/
|
|
│ ├── tunnel/ # In-memory WireGuard engine
|
|
│ ├── identity/ # HWID & Registration logic
|
|
│ └── crypto/ # AES Decryption untuk config API
|
|
├── agent.md # Dokumentasi panduan untuk AI Agent dev
|
|
└── main.go # Nama binary disamarkan saat build
|
|
```
|
|
|
|
---
|
|
|
|
### **Skema Komunikasi Antar Repo**
|
|
|
|
1. **Dashboard (Repo 2) ↔ Server Core (Repo 1):**
|
|
* Menggunakan REST API dengan **JWT Authentication**.
|
|
* Dashboard mengirim request "Buka Port", Server Core mengupdate `nftables`.
|
|
|
|
2. **Device Agent (Repo 3) ↔ Server Core (Repo 1):**
|
|
* Menggunakan REST API dengan **AES-Encrypted Payload**.
|
|
* Agent mengirim HWID, Server Core mengirim balik konfigurasi WireGuard yang sudah di-encrypt.
|
|
|
|
3. **Deployment (Gitea):**
|
|
* Ketiga repo di-host di Gitea.
|
|
* Repo 3 memiliki CI/CD yang mem-publish binary ke Gitea Releases.
|
|
* Installer script di perangkat mendownload binary dari Gitea menggunakan `X-Token-Auth`.
|
|
|
|
---
|
|
|
|
### **Master Prompt untuk Inisialisasi 3 Repo**
|
|
|
|
Jika Anda memberikan instruksi ke AI untuk mulai membuat kode, gunakan prompt ini:
|
|
|
|
```markdown
|
|
# Context: NexusGuard SD-WAN System
|
|
Please generate the initial boilerplate for 3 separate repositories:
|
|
|
|
1. REPO_SERVER: Go-Gin project. Focus on PostgreSQL schema for multi-tenant devices and firewall rules. Implement a service that manages 'nftables' sets for user isolation. Include a migration-ready documentation (docs/API_SPEC.md).
|
|
|
|
2. REPO_UI: Vue.js 3 + Capacitor project. Focus on the API service layer to communicate with REPO_SERVER. Create a dashboard for device monitoring and a firewall rule editor.
|
|
|
|
3. REPO_AGENT: Go project. Focus on 'wireguard-go' library integration (no config files). Implement HWID collection and an encrypted provisioning client that fetches keys from REPO_SERVER.
|
|
|
|
# Constraints:
|
|
- Use Zero Trust Isolation (Default DROP).
|
|
- Support UDP Hole Punching.
|
|
- Implement 30-day Key Rotation logic.
|
|
- Agent must be stealth (no standard WireGuard file traces).
|
|
```
|
|
|
|
### **Review Akhir Divisi:**
|
|
* **Divisi Backend** bisa fokus pada performa kernel dan database.
|
|
* **Divisi Frontend** bisa fokus pada UX yang memudahkan user mengatur jaringan yang kompleks.
|
|
* **Divisi System** bisa fokus pada kompatibilitas agent di berbagai OS (Linux ARM/x86).
|
|
|
|
**Apakah pembagian 3 repositori ini sudah sesuai dengan struktur tim Anda?** |