From 3d51aa455006903345f554a2dd90034993796114 Mon Sep 17 00:00:00 2001 From: sergei Date: Tue, 14 Apr 2026 06:23:55 +0400 Subject: vpnem: VPN infrastructure with load-balanced multi-protocol nodes - Multi-protocol VPS nodes (VLESS-REALITY + Hysteria2 + SOCKS5) - Smart load balancing via recommendation API - Windows/Linux client (Go + Wails + sing-box) - Server API with RealIP detection and connection tracking - Auto-deployment via vpnui control plane - Silent Windows installer with UAC elevation - Load-based server recommendation (no sticky sessions) - Best Server one-click connection workflow --- internal/control/bootstrap_test.go | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 internal/control/bootstrap_test.go (limited to 'internal/control/bootstrap_test.go') diff --git a/internal/control/bootstrap_test.go b/internal/control/bootstrap_test.go new file mode 100644 index 0000000..70e5ccb --- /dev/null +++ b/internal/control/bootstrap_test.go @@ -0,0 +1,58 @@ +package control + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestRenderBootstrapScript(t *testing.T) { + t.Parallel() + + script := RenderBootstrapPrepareScript() + script += RenderBootstrapFinalizeScript(Node{ + ID: "nl-01", + Name: "NL 01", + Region: "nl", + Host: "203.0.113.10", + Domain: "nl-01.example.com", + Enabled: true, + SSH: SSHConfig{ + User: "root", + Port: 22, + Auth: "key", + }, + }, "20260401-123000", "/tmp/vpnem-node-nl-01.tar.gz") + + if !strings.Contains(script, "mkdir -p /opt/vpnem-node/releases") { + t.Fatal("expected remote workdir creation") + } + if !strings.Contains(script, "vpnem-node release 20260401-123000 ready for nl-01") { + t.Fatal("expected release finalize message") + } +} + +func TestSaveNodeState(t *testing.T) { + t.Parallel() + + dir := t.TempDir() + err := SaveNodeState(dir, NodeState{ + NodeID: "nl-01", + BootstrapStatus: "ready", + Services: []ServiceStatus{ + {Type: "vless", Status: "configured", Port: 443}, + }, + }) + if err != nil { + t.Fatalf("SaveNodeState error = %v", err) + } + + data, err := os.ReadFile(filepath.Join(dir, "nl-01.json")) + if err != nil { + t.Fatalf("ReadFile error = %v", err) + } + if !strings.Contains(string(data), `"bootstrap_status": "ready"`) { + t.Fatal("expected bootstrap_status in state file") + } +} -- cgit v1.2.3