displayclient

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package displayclient provides a golang implementation of websockify, transforming a websocket connection to an ioext.ReadWriteCloser object.

The goal of this is to make it easy to interact with a VNC connection from a go application. Both for writing tests and command line utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Display

type Display struct {
	displayconsts.DisplayEntry
	// contains filtered or unexported fields
}

A Display structure holds information about a display returned from ListDisplays()

func ListDisplays

func ListDisplays(socketURL string) ([]Display, error)

ListDisplays will fetch a list of displays offered by the socketURL.

func (Display) OpenDisplay

func (d Display) OpenDisplay() (*DisplayClient, error)

OpenDisplay will attempt to open a websocket and create a DisplayClient for the display.

type DisplayClient

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

DisplayClient implements io.Reader, io.Writer and io.Closer for a VNC connection over a websocket. Similar to websockify.

func Dial

func Dial(socketURL string, display string) (*DisplayClient, error)

Dial will open a websocket to socketURL, pass the display string to the server and return a DisplayClient implementing ioext.ReadWriteCloser using the websocket.

Use ListDisplays() to find available displays.

func New

func New(ws *websocket.Conn) *DisplayClient

New returns a new display client implementing the ioext.ReadWriteCloser interface using a websocket.

The DisplayClient essentially takes care of sending and receiving ping/pongs to keep the websocket alive. However, the DisplayClient does read/write directly on websocket without any buffering, hence, you must keep calling Read() with a non-empty buffer to keep the connection alive.

func (*DisplayClient) Close

func (c *DisplayClient) Close() error

Close will close the underlying websocket and release all resources held by the DisplayClient.

func (*DisplayClient) Read

func (c *DisplayClient) Read(p []byte) (int, error)

func (*DisplayClient) Write

func (c *DisplayClient) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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