vnc

package
v1.40.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VNCFrame

type VNCFrame struct {
	Width  int
	Height int
	Pixels []byte // len == Width*Height*4
}

VNCFrame is a snapshot of the framebuffer after one or more updates. Pixels are packed as little-endian BGRX (4 bytes per pixel, X = ignored).

func (*VNCFrame) Clone

func (f *VNCFrame) Clone() *VNCFrame

Clone returns a deep copy so the consumer can hold onto a frame while the stream keeps mutating its internal buffer.

type VNCStream

type VNCStream struct {
	Frames chan *VNCFrame
	Err    chan error
	// contains filtered or unexported fields
}

VNCStream owns the connection. Frames are pushed onto Frames; errors that terminate the stream land on Err. Both channels close when the stream ends.

func DialVNC

func DialVNC(ctx context.Context, rawURL string, fps int) (*VNCStream, error)

DialVNC connects to a noVNC websockify endpoint. The URL may be either:

http(s)://host:port           → /websockify is appended automatically
ws(s)://host:port/websockify  → used as-is

The returned stream is already running its read loop; call Close when done. fps caps how often FramebufferUpdateRequest is re-issued (the cloud sandbox's xtigervnc pushes deltas, so this acts as a backstop, not a polling rate). DialVNC connects to a noVNC websockify endpoint. ctx may be nil, in which case context.Background() is used. The returned stream is already running its read loop; call Close when done.

func (*VNCStream) Close

func (s *VNCStream) Close()

Close terminates the stream. Safe to call multiple times.

func (*VNCStream) SendKey

func (s *VNCStream) SendKey(keysym uint32, down bool) error

SendKey emits an RFB KeyEvent for the given X11 keysym. down=true is a press; down=false is a release. RFB has no concept of "key repeat" — the caller is responsible for sending matched press/release pairs.

func (*VNCStream) SendPointer

func (s *VNCStream) SendPointer(x, y int, buttonMask byte) error

SendPointer emits an RFB PointerEvent. buttonMask is a bitmap with bit 0=left, 1=middle, 2=right, 3=wheel-up, 4=wheel-down. x,y are in the remote framebuffer's pixel coordinate space.

Jump to

Keyboard shortcuts

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