desktopbridge

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolVersion = "redeven-desktop-bridge-v1"

	FrameTypeHello           = "hello"
	FrameTypeStreamOpen      = "stream_open"
	FrameTypeStreamData      = "stream_data"
	FrameTypeStreamClose     = "stream_close"
	FrameTypeStreamError     = "stream_error"
	FrameTypeShutdownRuntime = "shutdown_runtime"
	FrameTypePing            = "ping"
	FrameTypePong            = "pong"
)
View Source
const (
	MaxPayloadBytes = 16 << 20
)

Variables

This section is empty.

Functions

func WriteFrame

func WriteFrame(w io.Writer, header FrameHeader, payload []byte) error

Types

type FrameHeader

type FrameHeader struct {
	ProtocolVersion string `json:"protocol_version"`
	StreamID        string `json:"stream_id"`
	Type            string `json:"type"`
	PayloadBytes    int64  `json:"payload_bytes,omitempty"`
}

func NormalizeFrameHeader

func NormalizeFrameHeader(header FrameHeader) (FrameHeader, error)

func ReadFrame

func ReadFrame(r io.Reader) (FrameHeader, []byte, error)

type GatewayProtocol added in v0.7.1

type GatewayProtocol struct {
	Available bool `json:"available"`
}

type Hello

type Hello struct {
	ProtocolVersion string          `json:"protocol_version"`
	RuntimeVersion  string          `json:"runtime_version"`
	RuntimeCommit   string          `json:"runtime_commit,omitempty"`
	StartedAtUnixMS int64           `json:"started_at_unix_ms,omitempty"`
	LocalUI         HelloLocalUI    `json:"local_ui"`
	RuntimeControl  RuntimeControl  `json:"runtime_control"`
	RuntimeService  any             `json:"runtime_service"`
	GatewayProtocol GatewayProtocol `json:"gateway_protocol,omitempty"`
}

type HelloLocalUI

type HelloLocalUI struct {
	Available bool   `json:"available"`
	BasePath  string `json:"base_path"`
}

type RuntimeControl

type RuntimeControl struct {
	Available       bool   `json:"available"`
	ProtocolVersion string `json:"protocol_version,omitempty"`
	BaseURL         string `json:"base_url,omitempty"`
	Token           string `json:"token,omitempty"`
	DesktopOwnerID  string `json:"desktop_owner_id,omitempty"`
}

type Server

type Server struct {
	DialSurface SurfaceDialer
	Hello       Hello
	OnShutdown  func()
	// contains filtered or unexported fields
}

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, in io.Reader, out io.Writer) error

IMPORTANT: The Desktop bridge is a placement transport. It must not become a provider tunnel, published-port shortcut, or host-network fallback.

type StreamError

type StreamError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type StreamOpen

type StreamOpen struct {
	Surface StreamSurface `json:"surface"`
}

type StreamSurface

type StreamSurface string
const (
	StreamSurfaceLocalUI         StreamSurface = "local_ui"
	StreamSurfaceRuntimeControl  StreamSurface = "runtime_control"
	StreamSurfaceGatewayProtocol StreamSurface = "gateway_protocol"
)

type SurfaceDialer

type SurfaceDialer func(context.Context, StreamSurface) (net.Conn, error)

func NewURLSurfaceDialer

func NewURLSurfaceDialer(localUIURL string, runtimeControlURL string) SurfaceDialer

func NewURLSurfaceDialerWithGateway added in v0.7.1

func NewURLSurfaceDialerWithGateway(localUIURL string, runtimeControlURL string, gatewayURL string, managedGatewayBridgeToken string) SurfaceDialer

Jump to

Keyboard shortcuts

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