web

package
v0.0.0-...-e0a4fd3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var FrontendFS embed.FS

Functions

func BuildRouter

func BuildRouter(cfg Config, sm *session.Manager) http.Handler

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

func LoggerMiddleware(next http.Handler) http.Handler

LoggerMiddleware returns middleware that logs requests.

func NewTLSRedirectListener

func NewTLSRedirectListener(inner net.Listener, tlsCfg *tls.Config, port int) net.Listener

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

func RecoveryMiddleware(next http.Handler) http.Handler

RecoveryMiddleware returns middleware that recovers from panics.

func UI

func UI() (fs.FS, error)

func WebSocketRelayHandler

func WebSocketRelayHandler(sm *session.Manager) http.Handler

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.

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, data any)

WriteJSON writes a JSON 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.

func (HTTPErrorLogAdapter) Write

func (HTTPErrorLogAdapter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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