wsrelay

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package wsrelay bridges WebSocket connections to the TerminalService RPC. It accepts WebSocket upgrades with a session_id query parameter, opens a StreamTerminal call, and pumps WebSocket frames ↔ RPC messages.

All messages are JSON text frames. Terminal output bytes are base64-encoded within the JSON TerminalServerMessage/TerminalClientMessage structs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthFunc

type AuthFunc func(r *http.Request) error

AuthFunc validates an HTTP request before allowing the WebSocket upgrade. Return nil to allow, non-nil error to reject. The error message is sent as a 403 response body.

type Relay

type Relay struct {
	// contains filtered or unexported fields
}

Relay bridges WebSocket connections to a TerminalService.

func NewRelay

func NewRelay(termSvc api.TerminalService, auth AuthFunc) *Relay

NewRelay creates a WebSocket relay backed by the given TerminalService. If auth is nil, no authentication is performed on the WebSocket upgrade.

func (*Relay) Handler

func (r *Relay) Handler() http.Handler

Handler returns an http.Handler that accepts WebSocket connections. Expected URL: /terminal/stream?session_id=<id>

Jump to

Keyboard shortcuts

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