Skip to content

Architecture ​

Layers ​

图表渲染中…

LayerResponsibility
Handlerparse, authorize, respond
Serviceorchestration, transactions, tasks
Driverplatform interaction and capability checks
Datapersistence
Taskasync execution, progress, retry

Request flow ​

text
auth (Bearer / session) → CSRF (writes) → access control
→ handler → service → driver (or task) → { code, msg, data, timestamp }

Authentication ​

ModeUseCredential
BearerAPI, CLI, pluginsAuthorization: Bearer <token>
Sessionbrowsercookie

Tokens are 32 random bytes (64 hex chars). Resetting invalidates old credentials.

CSRF ​

Writes require X-CSRF-Token, obtained from GET /api/csrf-token. GET/HEAD/OPTIONS are exempt. The CLI handles this automatically.

Drivers ​

internal/driver/interface.go defines HostDriver (list, create, update, delete, power, VNC, screenshot, backups). A new platform = implement the interface + register in createDriver and engine_config.

Capability metadata ​

EngineMeta fields: enabled, is_remote, platform, arch, options, messages, ban_init, ban_edit, tab_lock. The UI renders from it.

Tasks ​

In-memory queue with 4 workers; writes to the same instance are serialized; tasks are persisted and resumable.

Data model ​

TableContent
usersaccounts, roles, quotas
hostshost config and status
vmsinstances and ownership
tasksasync tasks
logsdatabase logs
settingskey/value settings
outbox / tombstonereconciliation

Maintenance jobs ​

Host sync, quota recalculation, outbox retry, tombstone sweep, screenshot cleanup.

Static assets ​

Gin serves static/ and falls back to index.html for SPA routes; VNCConsole/ hosts noVNC; Caddy runs as a child process managed through its Admin API.

Released under the AGPLv3 License.