VNCSession represents an active VNC session with comprehensive metadata and lifecycle management. Each session corresponds to a single VNC connection to a Proxmox target (VM, container, or node shell).
| 58 | // and lifecycle management. Each session corresponds to a single VNC connection |
| 59 | // to a Proxmox target (VM, container, or node shell). |
| 60 | type VNCSession struct { |
| 61 | // ID is a unique identifier for this session, used for tracking and management |
| 62 | ID string |
| 63 | |
| 64 | // Target information for the VNC connection |
| 65 | TargetType SessionType // "vm", "lxc", or "node" |
| 66 | NodeName string // Proxmox node name |
| 67 | VMID string // VM/Container ID (empty for node shells) |
| 68 | TargetName string // Display name for the target |
| 69 | |
| 70 | // Network configuration |
| 71 | Port int // Local HTTP server port for this session |
| 72 | URL string // Full URL to access this session |
| 73 | |
| 74 | // Session lifecycle tracking |
| 75 | CreatedAt time.Time // When this session was created |
| 76 | LastUsed time.Time // Last time this session was accessed |
| 77 | State SessionState // Current connection state |
| 78 | |
| 79 | // VNC connection details |
| 80 | ProxyConfig *ProxyConfig // VNC proxy configuration from Proxmox API |
| 81 | |
| 82 | // Server management |
| 83 | Server *Server // The HTTP server instance for this session |
| 84 | |
| 85 | // Connection tracking |
| 86 | activeConnections int // Number of active WebSocket connections |
| 87 | disconnectChan chan struct{} // Channel to signal disconnection |
| 88 | sessionManager *SessionManager // Reference to session manager for cleanup notifications |
| 89 | |
| 90 | // Cleanup management |
| 91 | cancelFunc context.CancelFunc // Function to cancel the session context |
| 92 | mutex sync.RWMutex // Protects concurrent access to session fields |
| 93 | } |
| 94 | |
| 95 | // UpdateLastUsed updates the last used timestamp for this session. |
| 96 | // This is called whenever the session is accessed to track activity |
nothing calls this directly
no outgoing calls
no test coverage detected