diff options
| author | sergei <sergei@em-sysadmin.xyz> | 2026-04-14 06:23:55 +0400 |
|---|---|---|
| committer | sergei <sergei@em-sysadmin.xyz> | 2026-04-14 06:23:55 +0400 |
| commit | 3d51aa455006903345f554a2dd90034993796114 (patch) | |
| tree | 62a7be2faf047f5eb7886feebc3b815556f03d7f /internal/control/inventory_test.go | |
| download | vpnem-main.tar.gz vpnem-main.tar.bz2 vpnem-main.zip | |
- 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
Diffstat (limited to 'internal/control/inventory_test.go')
| -rw-r--r-- | internal/control/inventory_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/internal/control/inventory_test.go b/internal/control/inventory_test.go new file mode 100644 index 0000000..eb03979 --- /dev/null +++ b/internal/control/inventory_test.go @@ -0,0 +1,50 @@ +package control + +import ( + "os" + "path/filepath" + "testing" +) + +func TestLoadInventoryDir(t *testing.T) { + t.Parallel() + + dir := t.TempDir() + input := `id: nl-01 +name: NL 01 +provider: custom-vps +region: nl +host: 203.0.113.10 +domain: nl-01.example.com +acme_email: admin@example.com +enabled: true +ssh: + user: root + port: 22 + auth: key + identity_file: ~/.ssh/id_ed25519 +protocols: + - type: vless + enabled: true + port: 443 + tls: + enabled: true + server_name: nl-01.example.com + auth: + uuid: 11111111-1111-1111-1111-111111111111 +` + if err := os.WriteFile(filepath.Join(dir, "nl-01.yaml"), []byte(input), 0o600); err != nil { + t.Fatal(err) + } + + inventory, err := LoadInventoryDir(dir) + if err != nil { + t.Fatalf("LoadInventoryDir error = %v", err) + } + if len(inventory.Nodes) != 1 { + t.Fatalf("len(inventory.Nodes) = %d, want 1", len(inventory.Nodes)) + } + if inventory.Nodes[0].ID != "nl-01" { + t.Fatalf("inventory.Nodes[0].ID = %q, want nl-01", inventory.Nodes[0].ID) + } +} |
