vnc

package
v0.0.0-...-77bde16 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

A workflow wraps a set of VNC requests together into a single object, allowing that object to be acted upon as a whole, rather than as individual requests.

The purpose of a workflow is to enable the VENUE VNC server to focus on a single client at a time, as simultaneous requests from multiple clients would otherwise conflict with one another.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Host

func Host(v string) func(*options) error

Host is an option for New() that sets the VENUE VNC host.

func Password

func Password(v string) func(*options) error

Password is an option for New() that sets the VENUE VNC password.

func Port

func Port(v uint) func(*options) error

Port is an option for New() that sets the VENUE VNC port.

Types

type ClientConn

type ClientConn interface {
	FramebufferHeight() uint16
	FramebufferWidth() uint16
	KeyEvent(key keys.Key, down bool) error
	PointerEvent(button buttons.Button, x, y uint16) error

	Close() error
	DebugMetrics()
	FramebufferUpdateRequest(inc rfbflags.RFBFlag, x, y, w, h uint16) error
	ListenAndHandle() error
}

ClientConn is a local interface to enable mocking of the go-vnc ClientConn.

type Event

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

Event describes a single workflow event.

type Framebuffer

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

Framebuffer maintains a local copy of the remote VNC image.

func NewFramebuffer

func NewFramebuffer(w, h int) *Framebuffer

NewFramebuffer returns a new Framebuffer object.

func (*Framebuffer) Height

func (f *Framebuffer) Height() int

Height returns the height of the framebuffer.

func (*Framebuffer) PNG

func (f *Framebuffer) PNG() (string, error)

PNG converts the framebuffer into a base64 encoded PNG string.

func (*Framebuffer) Paint

func (f *Framebuffer) Paint(r vnclib.Rectangle, colors []vnclib.Color)

Paint accepts a Rectangle and Color data, and paints the framebuffer with it.

func (*Framebuffer) Width

func (f *Framebuffer) Width() int

Width returns the width of the framebuffer.

type Sleeper

type Sleeper interface {
	Sleep(d time.Duration)
}

type VNC

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

The VNC type contains various handles relating to a VNC connection.

func New

func New(opts ...func(*options) error) (*VNC, error)

New returns a populated VNC structure.

func (*VNC) ClientConn

func (v *VNC) ClientConn() ClientConn

func (*VNC) Close

func (v *VNC) Close() error

Close a VNC connection.

func (*VNC) Connect

func (v *VNC) Connect(ctx context.Context) error

Connect to a Venue console.

func (*VNC) DebugMetrics

func (v *VNC) DebugMetrics()

DebugMetrics passes the call through to the connection.

func (*VNC) FramebufferRefresh

func (v *VNC) FramebufferRefresh(p time.Duration)

FramebufferRefresh refreshes the local framebuffer image of the VNC server every period `p`.

func (*VNC) ListenAndHandle

func (v *VNC) ListenAndHandle()

ListenAndHandle VNC server messages.

func (*VNC) Snapshot

func (v *VNC) Snapshot(r image.Rectangle) error

Snapshot requests updated image info from the VNC server.

type Workflow

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

Workflow holds a client connection to the VNC server, and a list of events.

func NewWorkflow

func NewWorkflow(conn ClientConn) *Workflow

NewWorkflow returns a new workflow object.

func (*Workflow) Execute

func (wf *Workflow) Execute() error

Execute the workflow against the VNC server.

func (*Workflow) KeyPress

func (wf *Workflow) KeyPress(key keys.Key)

KeyPress presses a key on the VENUE console.

func (*Workflow) MouseClick

func (wf *Workflow) MouseClick(b buttons.Button, p image.Point)

MouseClick moves the mouse to a position and left clicks.

func (*Workflow) MouseDrag

func (wf *Workflow) MouseDrag(p, d image.Point)

MouseDrag moves the mouse, clicks, and drags to a new position.

func (*Workflow) MouseMove

func (wf *Workflow) MouseMove(p image.Point)

MouseMove moves the mouse.

func (*Workflow) Sleep

func (wf *Workflow) Sleep(d time.Duration)

Sleep the workflow for at least the duration d.

Directories

Path Synopsis
Package messages defines the VNC Workflow messages used by Venue.
Package messages defines the VNC Workflow messages used by Venue.

Jump to

Keyboard shortcuts

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