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 ¶
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.