vnc

package
v0.0.0-...-81ce8a9 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeSetPixelFormat uint8 = iota

	TypeSetEncodings
	TypeFramebufferUpdateRequest
	TypeKeyEvent
	TypePointerEvent
	TypeClientCutText
)

Client to server messages. See RFC 6143 Section 7.5

View Source
const (
	TypeFramebufferUpdate uint8 = iota
	TypeSetColorMapEntries
	TypeBell
	TypeServerCutText
)

Server to client messages. See RFC 6143 Section 7.6

View Source
const (
	RawEncoding               = 0
	TightEncoding             = 7
	DesktopSizePseudoEncoding = -223
	CursorPseudoEncoding      = -239
)

Variables

This section is empty.

Functions

func ReadClientMessage

func ReadClientMessage(r io.Reader) (interface{}, error)

ReadClientMessage reads the next client-to-server message

Types

type Bell

type Bell struct {
}

See RFC 6143 Section 7.6.3

type ClientCutText

type ClientCutText struct {
	Text []uint8
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.5.6

func (*ClientCutText) Write

func (m *ClientCutText) Write(w io.Writer) error

type Color

type Color struct {
	R, G, B uint16
}

See RFC 6143 Section 7.6.2

type Conn

type Conn struct {
	net.Conn // embed
	// contains filtered or unexported fields
}

func Dial

func Dial(host string) (*Conn, error)

Dial a VNC server and complete the handshake

func (*Conn) ReadMessage

func (c *Conn) ReadMessage() (interface{}, error)

ReadMessage reads the next server-to-client message

type Control

type Control int

VNC playback control

const (
	Play Control = iota
	Pause
	Step
	LoadFile
	WaitForIt
	ClickIt
)

type Event

type Event interface {
	Write(w io.Writer) error
}

Events can be written to a vnc connect

type FramebufferUpdate

type FramebufferUpdate struct {
	NumRectangles uint16
	Rectangles    []*Rectangle
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.6.1

type FramebufferUpdateRequest

type FramebufferUpdateRequest struct {
	Incremental uint8
	X           uint16
	Y           uint16
	Width       uint16
	Height      uint16
}

See RFC 6143 Section 7.5.3

func (*FramebufferUpdateRequest) Write

type KeyEvent

type KeyEvent struct {
	DownFlag uint8

	Key uint32
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.5.4

func (*KeyEvent) String

func (m *KeyEvent) String() string

func (*KeyEvent) Write

func (m *KeyEvent) Write(w io.Writer) error

type LoadFileEvent

type LoadFileEvent struct {
	File string
}

LoadFileEvent is a pseudo event indicating that we should start reading events from a different file.

type PixelFormat

type PixelFormat struct {
	BitsPerPixel, Depth, BigEndianFlag, TrueColorFlag uint8
	RedMax, GreenMax, BlueMax                         uint16
	RedShift, GreenShift, BlueShift                   uint8
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.4

type Player

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

Player keeps track of active playbacks.

func NewPlayer

func NewPlayer() *Player

func (*Player) Clear

func (p *Player) Clear()

Clear stops all playbacks

func (*Player) Continue

func (p *Player) Continue(id string) error

func (*Player) GetStep

func (p *Player) GetStep(id string) (string, error)

func (*Player) Info

func (p *Player) Info() [][]string

func (*Player) Inject

func (p *Player) Inject(id, rhost, s string) error

func (*Player) Pause

func (p *Player) Pause(id string) error

func (*Player) Playback

func (p *Player) Playback(id, rhost, filename string) error

Creates a new VNC connection, the initial playback reader, and starts the vnc playback

func (*Player) Step

func (p *Player) Step(id string) error

func (*Player) Stop

func (p *Player) Stop(id string) error

type PointerEvent

type PointerEvent struct {
	ButtonMask uint8
	XPosition  uint16
	YPosition  uint16
}

See RFC 6143 Section 7.5.5

func (*PointerEvent) String

func (m *PointerEvent) String() string

func (*PointerEvent) Write

func (m *PointerEvent) Write(w io.Writer) error

type Recorder

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

Recorder keeps track of active recordings.

func NewRecorder

func NewRecorder() *Recorder

func (*Recorder) Clear

func (r *Recorder) Clear()

Clear stops all recordings

func (*Recorder) Info

func (r *Recorder) Info() [][]string

func (*Recorder) RecordFB

func (r *Recorder) RecordFB(id, rhost, filename string) error

func (*Recorder) RecordKB

func (r *Recorder) RecordKB(id, rhost, filename string) error

func (*Recorder) Route

func (r *Recorder) Route(id string, msg interface{})

Route records a message for the correct recording based on the VM

func (*Recorder) StopFB

func (r *Recorder) StopFB(id string) error

func (*Recorder) StopKB

func (r *Recorder) StopKB(id string) error

type Rectangle

type Rectangle struct {
	X            uint16
	Y            uint16
	Width        uint16
	Height       uint16
	EncodingType int32

	// rgba is the pixel data for this Rectangle
	*image.RGBA
}

See RFC 6143 Section 7.6.1

type Server

type Server struct {
	Width  uint16
	Height uint16
	PixelFormat
	NameLength uint32
	Name       []uint8
}

See RFC 6143 Section 7.3.2

type ServerCutText

type ServerCutText struct {
	Length uint32 // Length of Text
	Text   []uint8
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.6.4

type SetColorMapEntries

type SetColorMapEntries struct {
	FirstColor uint16
	NumColors  uint16
	Colors     []Color
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.6.2

type SetEncodings

type SetEncodings struct {
	Encodings []int32
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.5.2

func (*SetEncodings) Write

func (m *SetEncodings) Write(w io.Writer) error

type SetPixelFormat

type SetPixelFormat struct {
	PixelFormat
	// contains filtered or unexported fields
}

See RFC 6143 Section 7.5.1

func (*SetPixelFormat) Write

func (m *SetPixelFormat) Write(w io.Writer) error

type WaitForItEvent

type WaitForItEvent struct {
	Source   string
	Template image.Image
	Timeout  time.Duration
	Click    bool
}

WaitForItEvent is a pseudo event indicating that we should wait for an image to appear on the screen. If click is true, we should click on the center of the image if it appears.

Jump to

Keyboard shortcuts

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