desktopbridge

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 10 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 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"`
}

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"
)

type SurfaceDialer

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

func NewURLSurfaceDialer

func NewURLSurfaceDialer(localUIURL string, runtimeControlURL string) SurfaceDialer

Jump to

Keyboard shortcuts

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