Documentation
¶
Index ¶
- Constants
- Variables
- func ParseProtoVersion(pv []byte) (uint, uint, error)
- func ServerClientInitHandler(cfg *ServerConfig, c *ServerConn) error
- func ServerSecurityHandler(cfg *ServerConfig, c *ServerConn) error
- func ServerServerInitHandler(cfg *ServerConfig, c *ServerConn) error
- func ServerVersionHandler(cfg *ServerConfig, c *ServerConn) error
- func SetUint32(buf []byte, pos int, val uint32)
- func TcpServe(url string, cfg *ServerConfig) error
- func WsServe(url string, cfg *ServerConfig) error
- type FramebufferUpdate
- type Key
- type Keys
- type MsgClientCutText
- type MsgClientFence
- type MsgClientQemuExtendedKey
- type MsgFramebufferUpdateRequest
- type MsgKeyEvent
- type MsgPointerEvent
- type MsgQEMUExtKeyEvent
- type MsgSetEncodings
- type MsgSetPixelFormat
- type SecurityHandler
- type SecuritySubType
- type SecurityType
- type ServerAuthNone
- type ServerAuthVNC
- type ServerConfig
- type ServerConn
- func (c *ServerConn) Close() error
- func (c *ServerConn) ColorMap() *common.ColorMap
- func (c *ServerConn) Conn() io.ReadWriter
- func (c *ServerConn) CurrentPixelFormat() *common.PixelFormat
- func (c *ServerConn) DesktopName() string
- func (c *ServerConn) Encodings() []common.IEncoding
- func (c *ServerConn) Height() uint16
- func (c *ServerConn) Protocol() string
- func (c *ServerConn) Read(buf []byte) (int, error)
- func (c *ServerConn) SetColorMap(cm *common.ColorMap)
- func (c *ServerConn) SetDesktopName(name string)
- func (c *ServerConn) SetEncodings(encs []common.EncodingType) error
- func (c *ServerConn) SetHeight(h uint16)
- func (c *ServerConn) SetPixelFormat(pf *common.PixelFormat) error
- func (c *ServerConn) SetProtoVersion(pv string)
- func (c *ServerConn) SetWidth(w uint16)
- func (c *ServerConn) Width() uint16
- func (c *ServerConn) Write(buf []byte) (int, error)
- type ServerHandler
- type TightCapability
- type TightServerInit
- type WsHandler
- type WsServer
Constants ¶
const ( ProtoVersionUnknown = "" ProtoVersion33 = "RFB 003.003\n" ProtoVersion38 = "RFB 003.008\n" )
const ( StandardVendor = "STDV" TridiaVncVendor = "TRDV" TightVncVendor = "TGHT" )
const ( SecTypeUnknown = SecurityType(0) SecTypeNone = SecurityType(1) SecTypeVNC = SecurityType(2) SecTypeVeNCrypt = SecurityType(19) )
const ( SecSubTypeVeNCrypt01Unknown = SecuritySubType(0) SecSubTypeVeNCrypt01Plain = SecuritySubType(19) SecSubTypeVeNCrypt01TLSNone = SecuritySubType(20) SecSubTypeVeNCrypt01TLSVNC = SecuritySubType(21) SecSubTypeVeNCrypt01TLSPlain = SecuritySubType(22) SecSubTypeVeNCrypt01X509None = SecuritySubType(23) SecSubTypeVeNCrypt01X509VNC = SecuritySubType(24) SecSubTypeVeNCrypt01X509Plain = SecuritySubType(25) )
const ( SecSubTypeVeNCrypt02Unknown = SecuritySubType(0) SecSubTypeVeNCrypt02Plain = SecuritySubType(256) SecSubTypeVeNCrypt02TLSNone = SecuritySubType(257) SecSubTypeVeNCrypt02TLSVNC = SecuritySubType(258) SecSubTypeVeNCrypt02TLSPlain = SecuritySubType(259) SecSubTypeVeNCrypt02X509None = SecuritySubType(260) SecSubTypeVeNCrypt02X509VNC = SecuritySubType(261) SecSubTypeVeNCrypt02X509Plain = SecuritySubType(262) )
const AUTH_FAIL = "Authentication Failure"
const ProtoVersionLength = 12
const (
SecSubTypeUnknown = SecuritySubType(0)
)
Variables ¶
var DefaultClientMessages = []common.ClientMessage{ &MsgSetPixelFormat{}, &MsgSetEncodings{}, &MsgFramebufferUpdateRequest{}, &MsgKeyEvent{}, &MsgPointerEvent{}, &MsgClientCutText{}, &MsgClientQemuExtendedKey{}, }
Functions ¶
func ServerClientInitHandler ¶
func ServerClientInitHandler(cfg *ServerConfig, c *ServerConn) error
func ServerSecurityHandler ¶
func ServerSecurityHandler(cfg *ServerConfig, c *ServerConn) error
func ServerServerInitHandler ¶
func ServerServerInitHandler(cfg *ServerConfig, c *ServerConn) error
func ServerVersionHandler ¶
func ServerVersionHandler(cfg *ServerConfig, c *ServerConn) error
func SetUint32 ¶
SetUint32 set 4 bytes at pos in buf to the val (in big endian format) A test is done to ensure there are 4 bytes available at pos in the buffer
func TcpServe ¶
func TcpServe(url string, cfg *ServerConfig) error
func WsServe ¶
func WsServe(url string, cfg *ServerConfig) error
Types ¶
type FramebufferUpdate ¶
type FramebufferUpdate struct {
NumRect uint16 // number-of-rectangles
Rects []*common.Rectangle // rectangles
// contains filtered or unexported fields
}
FramebufferUpdate holds a FramebufferUpdate wire format message.
type MsgClientCutText ¶
type MsgClientCutText struct {
Length uint32 // length
Text []byte
// contains filtered or unexported fields
}
MsgClientCutText holds the wire format message, sans the text field.
func (*MsgClientCutText) Read ¶
func (*MsgClientCutText) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgClientCutText) Type ¶
func (*MsgClientCutText) Type() common.ClientMessageType
type MsgClientFence ¶
type MsgClientFence struct {
}
func (*MsgClientFence) Read ¶
func (cf *MsgClientFence) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgClientFence) Type ¶
func (*MsgClientFence) Type() common.ClientMessageType
type MsgClientQemuExtendedKey ¶
type MsgClientQemuExtendedKey struct {
SubType uint8 // sub type
IsDown uint16 // button down indicator
KeySym uint32 // key symbol
KeyCode uint32 // key code
}
MsgClientQemuExtendedKey holds the wire format message, for qemu keys
func (*MsgClientQemuExtendedKey) Read ¶
func (*MsgClientQemuExtendedKey) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgClientQemuExtendedKey) Type ¶
func (*MsgClientQemuExtendedKey) Type() common.ClientMessageType
type MsgFramebufferUpdateRequest ¶
type MsgFramebufferUpdateRequest struct {
Inc uint8 // incremental
X, Y uint16 // x-, y-position
Width, Height uint16 // width, height
}
MsgFramebufferUpdateRequest holds the wire format message.
func (*MsgFramebufferUpdateRequest) Read ¶
func (*MsgFramebufferUpdateRequest) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgFramebufferUpdateRequest) Type ¶
func (*MsgFramebufferUpdateRequest) Type() common.ClientMessageType
type MsgKeyEvent ¶
type MsgKeyEvent struct {
Down uint8 // down-flag
Key Key // key
// contains filtered or unexported fields
}
MsgKeyEvent holds the wire format message.
func (*MsgKeyEvent) Read ¶
func (*MsgKeyEvent) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgKeyEvent) Type ¶
func (*MsgKeyEvent) Type() common.ClientMessageType
type MsgPointerEvent ¶
PointerEventMessage holds the wire format message.
func (*MsgPointerEvent) Read ¶
func (*MsgPointerEvent) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgPointerEvent) Type ¶
func (*MsgPointerEvent) Type() common.ClientMessageType
type MsgQEMUExtKeyEvent ¶
type MsgQEMUExtKeyEvent struct {
SubmessageType uint8 // submessage type
DownFlag uint16 // down-flag
KeySym Key // key symbol
KeyCode uint32 // scan code
}
MsgKeyEvent holds the wire format message.
func (*MsgQEMUExtKeyEvent) Read ¶
func (*MsgQEMUExtKeyEvent) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgQEMUExtKeyEvent) Type ¶
func (*MsgQEMUExtKeyEvent) Type() common.ClientMessageType
type MsgSetEncodings ¶
type MsgSetEncodings struct {
EncNum uint16 // number-of-encodings
Encodings []common.EncodingType
// contains filtered or unexported fields
}
MsgSetEncodings holds the wire format message, sans encoding-type field.
func (*MsgSetEncodings) Read ¶
func (*MsgSetEncodings) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgSetEncodings) Type ¶
func (*MsgSetEncodings) Type() common.ClientMessageType
type MsgSetPixelFormat ¶
type MsgSetPixelFormat struct {
PF common.PixelFormat // pixel-format
// contains filtered or unexported fields
}
MsgSetPixelFormat holds the wire format message.
func (*MsgSetPixelFormat) Read ¶
func (*MsgSetPixelFormat) Read(c io.Reader) (common.ClientMessage, error)
func (*MsgSetPixelFormat) Type ¶
func (*MsgSetPixelFormat) Type() common.ClientMessageType
type SecurityHandler ¶
type SecurityHandler interface {
Type() SecurityType
SubType() SecuritySubType
Auth(common.IServerConn) error
}
type SecuritySubType ¶
type SecuritySubType uint32
type SecurityType ¶
type SecurityType uint8
type ServerAuthNone ¶
type ServerAuthNone struct{}
ServerAuthNone is the "none" authentication. See 7.2.1.
func (*ServerAuthNone) Auth ¶
func (*ServerAuthNone) Auth(c common.IServerConn) error
func (*ServerAuthNone) SubType ¶
func (*ServerAuthNone) SubType() SecuritySubType
func (*ServerAuthNone) Type ¶
func (*ServerAuthNone) Type() SecurityType
type ServerAuthVNC ¶
type ServerAuthVNC struct {
Pass string
}
ServerAuthVNC is the standard password authentication. See 7.2.2.
func (*ServerAuthVNC) Auth ¶
func (auth *ServerAuthVNC) Auth(c common.IServerConn) error
func (*ServerAuthVNC) SubType ¶
func (*ServerAuthVNC) SubType() SecuritySubType
func (*ServerAuthVNC) Type ¶
func (*ServerAuthVNC) Type() SecurityType
type ServerConfig ¶
type ServerConfig struct {
SecurityHandlers []SecurityHandler
Encodings []common.IEncoding
PixelFormat *common.PixelFormat
ColorMap *common.ColorMap
ClientMessages []common.ClientMessage
DesktopName []byte
Height uint16
Width uint16
UseDummySession bool
//handler to allow for registering for messages, this can't be a channel
//because of the websockets handler function which will kill the connection on exit if conn.handle() is run on another thread
NewConnHandler ServerHandler
}
type ServerConn ¶
type ServerConn struct {
// a consumer for the parsed messages, to allow for recording and proxy
Listeners *common.MultiListener
SessionId string
// contains filtered or unexported fields
}
func NewServerConn ¶
func NewServerConn(c io.ReadWriter, cfg *ServerConfig) (*ServerConn, error)
func (*ServerConn) Close ¶
func (c *ServerConn) Close() error
func (*ServerConn) ColorMap ¶
func (c *ServerConn) ColorMap() *common.ColorMap
func (*ServerConn) Conn ¶
func (c *ServerConn) Conn() io.ReadWriter
func (*ServerConn) CurrentPixelFormat ¶
func (c *ServerConn) CurrentPixelFormat() *common.PixelFormat
func (*ServerConn) DesktopName ¶
func (c *ServerConn) DesktopName() string
func (*ServerConn) Encodings ¶
func (c *ServerConn) Encodings() []common.IEncoding
func (*ServerConn) Height ¶
func (c *ServerConn) Height() uint16
func (*ServerConn) Protocol ¶
func (c *ServerConn) Protocol() string
func (*ServerConn) SetColorMap ¶
func (c *ServerConn) SetColorMap(cm *common.ColorMap)
func (*ServerConn) SetDesktopName ¶
func (c *ServerConn) SetDesktopName(name string)
func (*ServerConn) SetEncodings ¶
func (c *ServerConn) SetEncodings(encs []common.EncodingType) error
func (*ServerConn) SetHeight ¶
func (c *ServerConn) SetHeight(h uint16)
func (*ServerConn) SetPixelFormat ¶
func (c *ServerConn) SetPixelFormat(pf *common.PixelFormat) error
func (*ServerConn) SetProtoVersion ¶
func (c *ServerConn) SetProtoVersion(pv string)
func (*ServerConn) SetWidth ¶
func (c *ServerConn) SetWidth(w uint16)
func (*ServerConn) Width ¶
func (c *ServerConn) Width() uint16
type ServerHandler ¶
type ServerHandler func(*ServerConfig, *ServerConn) error
type TightCapability ¶
type TightCapability struct {
// contains filtered or unexported fields
}
type TightServerInit ¶
type TightServerInit struct {
ServerMessageCaps []TightCapability
ClientMessageCaps []TightCapability
EncodingCaps []TightCapability
}
void initCapabilities() {
tunnelCaps = new CapsContainer();
authCaps = new CapsContainer();
serverMsgCaps = new CapsContainer();
clientMsgCaps = new CapsContainer();
encodingCaps = new CapsContainer();
// Supported authentication methods
authCaps.add(AuthNone, StandardVendor, SigAuthNone,
"No authentication");
authCaps.add(AuthVNC, StandardVendor, SigAuthVNC,
"Standard VNC password authentication");
// Supported non-standard server-to-client messages
// [NONE]
// Supported non-standard client-to-server messages
// [NONE]
// Supported encoding types
encodingCaps.add(EncodingCopyRect, StandardVendor,
SigEncodingCopyRect, "Standard CopyRect encoding");
encodingCaps.add(EncodingRRE, StandardVendor,
SigEncodingRRE, "Standard RRE encoding");
encodingCaps.add(EncodingCoRRE, StandardVendor,
SigEncodingCoRRE, "Standard CoRRE encoding");
encodingCaps.add(EncodingHextile, StandardVendor,
SigEncodingHextile, "Standard Hextile encoding");
encodingCaps.add(EncodingZRLE, StandardVendor,
SigEncodingZRLE, "Standard ZRLE encoding");
encodingCaps.add(EncodingZlib, TridiaVncVendor,
SigEncodingZlib, "Zlib encoding");
encodingCaps.add(EncodingTight, TightVncVendor,
SigEncodingTight, "Tight encoding");
// Supported pseudo-encoding types
encodingCaps.add(EncodingCompressLevel0, TightVncVendor,
SigEncodingCompressLevel0, "Compression level");
encodingCaps.add(EncodingQualityLevel0, TightVncVendor,
SigEncodingQualityLevel0, "JPEG quality level");
encodingCaps.add(EncodingXCursor, TightVncVendor,
SigEncodingXCursor, "X-style cursor shape update");
encodingCaps.add(EncodingRichCursor, TightVncVendor,
SigEncodingRichCursor, "Rich-color cursor shape update");
encodingCaps.add(EncodingPointerPos, TightVncVendor,
SigEncodingPointerPos, "Pointer position update");
encodingCaps.add(EncodingLastRect, TightVncVendor,
SigEncodingLastRect, "LastRect protocol extension");
encodingCaps.add(EncodingNewFBSize, TightVncVendor,
SigEncodingNewFBSize, "Framebuffer size change");
}
type WsHandler ¶
type WsHandler func(io.ReadWriter, *ServerConfig, string)