🐛 fix: harden connection lifecycle and add session safeguards

This commit is contained in:
2026-07-16 21:58:54 +07:00
parent 65e3671671
commit 3c6950573f
5 changed files with 487 additions and 96 deletions
+4
View File
@@ -28,6 +28,8 @@ type Config struct {
MaxAuthAttempts int
HandshakeTimeout time.Duration
MaxDimension int
MaxTerminalCells int
SessionTimeout time.Duration
RenderCacheMB int
BrightnessThreshold int
Charset string
@@ -126,6 +128,8 @@ func loadConfig() Config {
MaxAuthAttempts: envInt("MAX_AUTH_ATTEMPTS", 6, 1, maxInt),
HandshakeTimeout: envDurationMs("HANDSHAKE_TIMEOUT", 10*time.Second),
MaxDimension: envInt("MAX_DIMENSION", 512, 1, 4096),
MaxTerminalCells: envInt("MAX_TERMINAL_CELLS", 500*512, 1, maxInt),
SessionTimeout: envDurationMs("SESSION_TIMEOUT", 10*time.Minute),
RenderCacheMB: envInt("RENDER_CACHE_MB", 256, 0, maxInt),
BrightnessThreshold: envInt("BRIGHTNESS_THRESHOLD", 40, 0, 100),
Charset: envString("CHARSET", "detailed"),