Documentation
¶
Index ¶
- Constants
- Variables
- func BuildRouter(cfg Config, sm *session.Manager) http.Handler
- func CloseWebSocketForSession(sessionID string)
- func ContainerProxyHandler(w http.ResponseWriter, r *http.Request)
- func GenerateSelfSignedCert() (tls.Certificate, error)
- func LoggerMiddleware(next http.Handler) http.Handler
- func NewTLSRedirectListener(inner net.Listener, tlsCfg *tls.Config, port int) net.Listener
- func RecoveryMiddleware(next http.Handler) http.Handler
- func UI() (fs.FS, error)
- func WebSocketRelayHandler(sm *session.Manager) http.Handler
- func WriteError(w http.ResponseWriter, status int, message string)
- func WriteJSON(w http.ResponseWriter, status int, data any)
- type Config
- type HTTPErrorLogAdapter
Constants ¶
const ( FlagSYN byte = 0x01 // Open new stream FlagDATA byte = 0x04 // Data frame FlagFIN byte = 0x08 // Close stream FlagRST byte = 0x10 // Abort stream )
Stream flags for WebSocket binary protocol
Variables ¶
var FrontendFS embed.FS
Functions ¶
func BuildRouter ¶
BuildRouter constructs and returns the main HTTP handler.
func CloseWebSocketForSession ¶
func CloseWebSocketForSession(sessionID string)
CloseWebSocketForSession closes ALL WebSocket connections associated with a session. Called when a session expires to immediately disconnect all tabs/windows.
func ContainerProxyHandler ¶
func ContainerProxyHandler(w http.ResponseWriter, r *http.Request)
ContainerProxyHandler reverse-proxies requests at /proxy/{name}/... to the container's internal IP on the linuxio-docker bridge network. The container must have the io.linuxio.container.proxy.port label set.
func GenerateSelfSignedCert ¶
func GenerateSelfSignedCert() (tls.Certificate, error)
func LoggerMiddleware ¶
LoggerMiddleware returns middleware that logs requests.
func NewTLSRedirectListener ¶
NewTLSRedirectListener returns a net.Listener that serves TLS for real TLS connections and returns an HTTP 301 redirect for plain-HTTP connections, all on the same port.
func RecoveryMiddleware ¶
RecoveryMiddleware returns middleware that recovers from panics.
func WebSocketRelayHandler ¶
WebSocketRelayHandler handles binary WebSocket connections as a pure byte relay. The server never parses payloads - just routes bytes between WebSocket and yamux streams.
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, message string)
WriteError writes a JSON error response with the given status code.
Types ¶
type Config ¶
type Config struct {
Verbose bool
UI fs.FS
RegisterRoutes func(mux *http.ServeMux) // Called to register API routes
}
Config holds router configuration.
type HTTPErrorLogAdapter ¶
type HTTPErrorLogAdapter struct{}
HTTPErrorLogAdapter adapts logger.Warnf to the log.Logger interface for http.Server.ErrorLog.