Documentation ¶
Overview ¶
Package vnc implements the client side of the Remote Framebuffer protocol, typically used in VNC clients.
References:
[PROTOCOL]: http://tools.ietf.org/html/rfc6143
Index ¶
- Constants
- type BellMsg
- type ClientAuth
- type ClientConn
- type ClientConnConfig
- type ClientCutTextMsg
- type ClientMessage
- type Color
- type ColorMap
- type CopyRectEncoding
- type CursorPseudoEncoding
- type DesktopSizePseudoEncoding
- type Encoding
- type EncodingType
- type FramebufferUpdateMsg
- type FramebufferUpdateRequestMsg
- type HextileEncoding
- type KeyEventMsg
- type MessageID
- type NoneAuth
- type PixelFormat
- type PointerEventMsg
- type RFBPixelFormat
- type RawEncoding
- type Rectangle
- type SecurityType
- type ServerCutTextMsg
- type ServerMessage
- type SetColorMapEntriesMsg
- type SetEncodingsMsg
- type SetPixelFormatMsg
- type VNCAuth
Constants ¶
const ( InvalidSecType = SecurityType(iota) NoneSecType VNCSecType )
const ( RawEncType = EncodingType(0) CopyRectEncType = EncodingType(1) HextileEncType = EncodingType(5) TightEncType = EncodingType(7) // DesktopSizePseudoEncType = EncodingType(-223) CursorPseudoEncType = EncodingType(-239) TightPNGEncType = EncodingType(-260) // ContinuousUpdatesPseudoEncType = EncodingType(-313) // )
const ( ProtocolVersion3_3 = "RFB 003.003\n" ProtocolVersion3_7 = "RFB 003.007\n" ProtocolVersion3_8 = "RFB 003.008\n" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BellMsg ¶
type BellMsg struct{}
Bell signals that an audible bell should be made on the client.
func (*BellMsg) Receive ¶
func (*BellMsg) Receive(*ClientConn) (ServerMessage, error)
type ClientAuth ¶
type ClientAuth interface { // Type returns the byte identifier sent by the server to // identify this authentication scheme. Type() SecurityType // Handshake is called when the authentication handshake should be // performed, as part of the general RFB handshake. (see 7.2.1) Handshake(*ClientConn) error }
A ClientAuth implements a method of authenticating with a remote server.
type ClientConn ¶
type ClientConn struct { // Width of the frame buffer in pixels, sent from the server. FrameBufferWidth uint16 // Height of the frame buffer in pixels, sent from the server. FrameBufferHeight uint16 // Name associated with the desktop, sent from the server. DesktopName string // contains filtered or unexported fields }
func NewClientConn ¶
func NewClientConn(cfg *ClientConnConfig, c net.Conn) (*ClientConn, error)
func (*ClientConn) Close ¶
func (c *ClientConn) Close() error
func (*ClientConn) Handshake ¶
func (c *ClientConn) Handshake() (err error)
func (*ClientConn) PixelFormat ¶
func (c *ClientConn) PixelFormat() *PixelFormat
func (*ClientConn) ReceiveMsg ¶
func (c *ClientConn) ReceiveMsg() (ServerMessage, error)
func (*ClientConn) SendMsg ¶
func (c *ClientConn) SendMsg(m ClientMessage) error
type ClientConnConfig ¶
type ClientConnConfig struct { Address string // A slice of ClientAuth methods. Only the first instance that is // suitable by the server will be used to authenticate. Auth []ClientAuth // Exclusive determines whether the connection is shared with other // clients. If true, then all other clients connected will be // disconnected when a connection is established to the VNC server. Exclusive bool // A map of supported messages that can be read from the server. // This only needs to contain NEW server messages, and doesn't // need to explicitly contain the RFC-required messages. ServerMessages map[MessageID]ServerMessage }
A ClientConnConfig structure is used to configure a ClientConn. After one has been passed to initialize a connection, it must not be modified.
type ClientCutTextMsg ¶
func (*ClientCutTextMsg) Send ¶
func (m *ClientCutTextMsg) Send(c *ClientConn) error
type ClientMessage ¶
type ClientMessage interface { // Send writes the content of the message to the writer, including the message type. Send(*ClientConn) error }
type CopyRectEncoding ¶
type CopyRectEncoding struct {
SX, SY uint16
}
func (*CopyRectEncoding) Read ¶
func (*CopyRectEncoding) Read(c *ClientConn, rect *Rectangle) (Encoding, error)
func (*CopyRectEncoding) Type ¶
func (*CopyRectEncoding) Type() EncodingType
type CursorPseudoEncoding ¶
type CursorPseudoEncoding struct {
// contains filtered or unexported fields
}
func (*CursorPseudoEncoding) PNG ¶
func (enc *CursorPseudoEncoding) PNG(rect *Rectangle) ([]byte, error)
func (*CursorPseudoEncoding) RGBA ¶
func (enc *CursorPseudoEncoding) RGBA(*Rectangle) ([]byte, error)
func (*CursorPseudoEncoding) Read ¶
func (*CursorPseudoEncoding) Read(c *ClientConn, rect *Rectangle) (Encoding, error)
func (*CursorPseudoEncoding) Type ¶
func (*CursorPseudoEncoding) Type() EncodingType
type DesktopSizePseudoEncoding ¶
type DesktopSizePseudoEncoding struct{}
func (*DesktopSizePseudoEncoding) Read ¶
func (*DesktopSizePseudoEncoding) Read(*ClientConn, *Rectangle) (Encoding, error)
func (*DesktopSizePseudoEncoding) Type ¶
func (*DesktopSizePseudoEncoding) Type() EncodingType
type Encoding ¶
type Encoding interface { // The number that uniquely identifies this encoding type. Type() EncodingType // Read reads the contents of the encoded pixel data from the reader. // This should return a new Encoding implementation that contains // the proper data. Read(*ClientConn, *Rectangle) (Encoding, error) }
An Encoding implements a method for encoding pixel data that is sent by the server to the client.
type EncodingType ¶
type EncodingType int32
type FramebufferUpdateMsg ¶
type FramebufferUpdateMsg struct {
Rectangles []Rectangle
}
FramebufferUpdateMsg consists of a sequence of rectangles of pixel data that the client should put into its framebuffer.
func (*FramebufferUpdateMsg) ID ¶
func (*FramebufferUpdateMsg) ID() MessageID
func (*FramebufferUpdateMsg) Receive ¶
func (*FramebufferUpdateMsg) Receive(c *ClientConn) (ServerMessage, error)
type FramebufferUpdateRequestMsg ¶
type FramebufferUpdateRequestMsg struct { ID MessageID Incremental uint8 X uint16 Y uint16 Width uint16 Height uint16 }
func (*FramebufferUpdateRequestMsg) Send ¶
func (m *FramebufferUpdateRequestMsg) Send(c *ClientConn) error
type HextileEncoding ¶
type HextileEncoding struct {
// contains filtered or unexported fields
}
func (*HextileEncoding) Read ¶
func (enc *HextileEncoding) Read(c *ClientConn, rect *Rectangle) (Encoding, error)
func (*HextileEncoding) Type ¶
func (*HextileEncoding) Type() EncodingType
type KeyEventMsg ¶
type KeyEventMsg struct { ID MessageID DownFlag uint8 Key uint32 // contains filtered or unexported fields }
func (*KeyEventMsg) Send ¶
func (m *KeyEventMsg) Send(c *ClientConn) error
type NoneAuth ¶
type NoneAuth struct{}
NoneAuth is the "none" authentication. See 7.2.1
func (*NoneAuth) Handshake ¶
func (*NoneAuth) Handshake(*ClientConn) error
func (*NoneAuth) Type ¶
func (*NoneAuth) Type() SecurityType
type PixelFormat ¶
type PixelFormat struct { ByPP uint8 ByteOrder binary.ByteOrder *RFBPixelFormat // If the pixel format uses a color map, then this is the color // map that is used. This should not be modified directly, since // the data comes from the server. ColorMap }
PixelFormat describes the way a pixel is formatted for a VNC connection.
See RFC 6143 Section 7.4 for information on each of the fields.
func NewPixelFormat ¶
func NewPixelFormat(rpf *RFBPixelFormat) *PixelFormat
func (*PixelFormat) ReadPixels ¶
type PointerEventMsg ¶
func (*PointerEventMsg) Send ¶
func (m *PointerEventMsg) Send(c *ClientConn) error
type RFBPixelFormat ¶
type RawEncoding ¶
type RawEncoding struct {
// contains filtered or unexported fields
}
RawEncoding is raw pixel data sent by the server.
func (*RawEncoding) Read ¶
func (*RawEncoding) Read(c *ClientConn, rect *Rectangle) (Encoding, error)
func (*RawEncoding) Type ¶
func (*RawEncoding) Type() EncodingType
type SecurityType ¶
type SecurityType uint8
type ServerCutTextMsg ¶
type ServerCutTextMsg struct {
Text string
}
ServerCutTextMsg indicates the server has new text in the cut buffer.
func (*ServerCutTextMsg) ID ¶
func (*ServerCutTextMsg) ID() MessageID
func (*ServerCutTextMsg) Receive ¶
func (*ServerCutTextMsg) Receive(c *ClientConn) (ServerMessage, error)
type ServerMessage ¶
type ServerMessage interface { // ID returns the id of the message that is sent down on the wire. ID() MessageID // Receive reads the content of the message from the reader. At the point // this is called, the message type has already been read from the reader. // This should return a new ServerMessage having the appropriate type. Receive(*ClientConn) (ServerMessage, error) }
type SetColorMapEntriesMsg ¶
SetColorMapEntriesMsg is sent by the server to set values into the color map. This message will automatically update the color map for the associated connection, but contains the color change data if the consumer wants to read it.
func (*SetColorMapEntriesMsg) ID ¶
func (*SetColorMapEntriesMsg) ID() MessageID
func (*SetColorMapEntriesMsg) Receive ¶
func (*SetColorMapEntriesMsg) Receive(c *ClientConn) (ServerMessage, error)
type SetEncodingsMsg ¶
func (*SetEncodingsMsg) Send ¶
func (m *SetEncodingsMsg) Send(c *ClientConn) error
type SetPixelFormatMsg ¶
type SetPixelFormatMsg struct { ID MessageID RFBPixelFormat // contains filtered or unexported fields }
func (*SetPixelFormatMsg) Send ¶
func (m *SetPixelFormatMsg) Send(c *ClientConn) error