Help us shape the future of Go! Take the 2026 Go Developer Survey

rfb

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Overview

Package rfb contains protocol primitives for the shared-display broker. The existing exclusive VNC bridge does not use this package yet.

Index

Constants

View Source
const (
	SetPixelFormat           byte = 0
	SetEncodings             byte = 2
	FramebufferUpdateRequest byte = 3
	KeyEvent                 byte = 4
	PointerEvent             byte = 5
	ClientCutText            byte = 6
	SetDesktopSize           byte = 251
	QEMU                     byte = 255

	MaxEncodings      = 1024
	MaxClipboardBytes = 1 << 20
	MaxScreens        = 16

	// QEMU audio client-message layout: type 255, subtype 1, u16 command,
	// then the command payload. Enable/disable carry none; set-format
	// carries the 6-byte sample format.
	QEMUSubAudio       byte   = 1
	QEMUAudioEnable    uint16 = 0
	QEMUAudioDisable   uint16 = 1
	QEMUAudioSetFormat uint16 = 2
)

Variables

View Source
var (
	ErrUnsupported = errors.New("unsupported RFB client message")
	ErrLimit       = errors.New("RFB client message exceeds limit")
)

Functions

This section is empty.

Types

type ClientMessage

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

ClientMessage is a complete, bounded post-handshake message. Its zero value has Invalid scope. Bytes returns a copy so consumers cannot change bytes after their scope has been determined.

func ReadClientMessage

func ReadClientMessage(r io.Reader) (ClientMessage, error)

ReadClientMessage reads exactly one message from the post-ServerInit RFB byte stream. It does not perform a handshake, authorize a participant, or validate negotiated pixel formats/encodings/geometry. The broker must do those checks before using a message. It must never forward ParticipantLocal messages directly: observer format/encoding choices are local to that viewer.

Read boundaries are not message boundaries; flatten binary WebSocket data before calling. Every error is terminal for this stream. In particular, do not skip an unknown message and attempt to resynchronize. The transport must supply deadlines/cancellation by closing its reader; memory limits do not prevent a peer from stalling midway through a message.

Supported extensions are SetDesktopSize, QEMU extended keys and the QEMU audio session commands (enable/disable/set-format, terminated by the broker). Continuous updates, Fence, extended clipboard and other extensions must not be advertised by the initial broker until explicitly implemented.

func (ClientMessage) Bytes

func (m ClientMessage) Bytes() []byte

func (ClientMessage) Scope

func (m ClientMessage) Scope() Scope

type Scope

type Scope uint8

Scope distinguishes participant-local protocol state from guest mutation. Neither scope permits opaque forwarding to the upstream RFB connection: local messages must be terminated by the broker, and guest mutations require a current control claim checked at dispatch (not merely when parsed).

const (
	Invalid Scope = iota
	ParticipantLocal
	GuestMutation
)

Jump to

Keyboard shortcuts

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