server

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package server provides the two HTTP servers for wsproxy:

  • terminal.go: :9003 WebSocket terminal reverse-proxy
  • internal.go: :9004 internal management API (Gin + OpenAPI-generated routes)

Package server contains the two HTTP servers that wsproxy exposes:

  • terminal.go (:9003) — WebSocket terminal proxy toward Worker clusters
  • internal.go (:9004) — Internal management API for Dashboard BFF

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BridgeConns

func BridgeConns(a, b *websocket.Conn)

BridgeConns copies messages bidirectionally between two WebSocket connections until one of them closes or returns an error.

func NewInternalServer

func NewInternalServer(cfg *config.Config, deps RouterDeps) *http.Server

NewInternalServer creates the :9004 management HTTP server. It registers the OpenAPI-generated strict routes (templates, api-keys, images catalog) behind jwtOrManagerTokenMiddleware, plus legacy /internal/* routes behind the static manager-token middleware.

func NewTerminalServer

func NewTerminalServer(cfg *config.Config, store *cluster.Store) *http.Server

NewTerminalServer creates the :9003 HTTP server that proxies WebSocket terminal connections from the Dashboard to the target Worker cluster.

func ParseTerminalPath

func ParseTerminalPath(rawPath string) (clusterID, sandboxID string, ok bool)

ParseTerminalPath parses a terminal proxy path of the form:

[<prefix>]/ws/clusters/{clusterID}/sandboxes/{sandboxID}/terminal

Returns (clusterID, sandboxID, true) on success, ("", "", false) otherwise.

Types

type RouterDeps

type RouterDeps struct {
	SyncManager  *syncmgr.SyncManager
	AdminKeyMgr  *apikey.AdminKeyManager
	KeyStore     syncmgr.KeyStore
	JWTSecret    string
	ManagerToken string
	IAMService   service.IAMService
}

RouterDeps bundles all dependencies required to build the internal HTTP router.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL