Add Go project scaffold for Wails v2 SSH/Telnet/RAW TCP client

- go.mod with Wails v2.9.2, x/crypto, go-sqlite3, go-keyring, uuid
- cmd/app/main.go: Wails entry point (Nexus Terminal, 1400x900, #1a1a2e)
- internal/app/app.go: lifecycle (Startup/Shutdown/DomReady)
- internal/models/models.go: full model definitions (Profile, SSHConfig,
  TelnetConfig, RAWConfig, SessionInfo, KnownHost, AppPreferences, etc.)
- internal/models/defaults.go: default values and NewProfile factory
- internal/validation/validation.go: thorough field-level validation
- frontend/embed.go: embedded frontend assets
- Updated existing storage, secrets, config to match new model structure
This commit is contained in:
2026-04-15 00:00:00 +01:00
commit 35bc9c75b1
36 changed files with 6226 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
// Package config resolves platform-specific application paths and configuration.
package config
import (
"os"
"path/filepath"
"runtime"
)
const appName = "NexusTerminal"
// AppConfig holds the resolved application configuration paths.
type AppConfig struct {
DataDir string // base data directory
DBPath string // SQLite database path
SecretPath string // encrypted vault directory
LogPath string // log file path
}
// Load resolves the application configuration.
// Data directory follows platform conventions:
// - macOS: ~/Library/Application Support/NexusTerminal
// - Linux: ~/.config/NexusTerminal
// - Windows: %APPDATA%/NexusTerminal
func Load() (*AppConfig, error) {
dataDir, err := resolveDataDir()
if err != nil {
return nil, err
}
cfg := &AppConfig{
DataDir: dataDir,
DBPath: filepath.Join(dataDir, "nexus.db"),
SecretPath: filepath.Join(dataDir, "vault"),
LogPath: filepath.Join(dataDir, "nexus.log"),
}
return cfg, nil
}
// EnsureDirectories creates required directories if they don't exist.
func (c *AppConfig) EnsureDirectories() error {
dirs := []string{
c.DataDir,
c.SecretPath,
filepath.Dir(c.LogPath),
}
for _, d := range dirs {
if err := os.MkdirAll(d, 0700); err != nil {
return err
}
}
return nil
}
// resolveDataDir determines the base data directory for the current platform.
func resolveDataDir() (string, error) {
var base string
switch runtime.GOOS {
case "darwin":
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
base = filepath.Join(home, "Library", "Application Support")
case "windows":
base = os.Getenv("APPDATA")
if base == "" {
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
base = filepath.Join(home, "AppData", "Roaming")
}
default: // Linux and other UNIX-likes
base = os.Getenv("XDG_CONFIG_HOME")
if base == "" {
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
base = filepath.Join(home, ".config")
}
}
return filepath.Join(base, appName), nil
}