Documentation ¶
Index ¶
- Constants
- Variables
- type ClientMessageType
- type Color
- type ColorMap
- type EncodingType
- type GetConn
- type IEncoding
- type IHandler
- type ISecurityHandler
- type ISession
- type Key
- type Keys
- type Message
- type MessageType
- type Option
- func OptDesktopName(opt []byte) Option
- func OptDisableClientMessageType(opt ...ClientMessageType) Option
- func OptDisableServerMessageType(opt ...ServerMessageType) Option
- func OptEncodings(opt ...IEncoding) Option
- func OptGetConn(opt GetConn) Option
- func OptHandlers(opt ...IHandler) Option
- func OptHeight(opt int) Option
- func OptMessages(opt ...Message) Option
- func OptPixelFormat(opt PixelFormat) Option
- func OptSecurityHandlers(opt ...ISecurityHandler) Option
- func OptWidth(opt int) Option
- type Options
- type PixelFormat
- type Rectangle
- type SecuritySubType
- type SecurityType
- type ServerMessageType
- type SessionType
- type TargetConfig
Constants ¶
View Source
const ( // ProtoVersionUnknown 未知协议 ProtoVersionUnknown = "" // ProtoVersion33 版本 003.003 ProtoVersion33 = "RFB 003.003\n" // ProtoVersion38 版本 003.008 ProtoVersion38 = "RFB 003.008\n" // ProtoVersion37 版本 003.007 ProtoVersion37 = "RFB 003.007\n" )
View Source
const PixelFormatLen = 16
View Source
const ProtoVersionLength = 12
ProtoVersionLength rfb协议长度
Variables ¶
View Source
var ( // PixelFormat8bit 获取8bit像素格式 PixelFormat8bit = NewPixelFormat(8) // PixelFormat16bit 获取15bit像素格式 PixelFormat16bit = NewPixelFormat(16) // PixelFormat32bit 获取32bit像素格式 PixelFormat32bit = NewPixelFormat(32) // PixelFormatAten returns pixel format used in Aten IKVM PixelFormatAten = NewPixelFormatAten() )
Functions ¶
This section is empty.
Types ¶
type ClientMessageType ¶
type ClientMessageType MessageType
ClientMessageType vnc客户端发送给vnc服务端的消息类型
const ( SetPixelFormat ClientMessageType = 0 // 设置像素格式 SetEncodings ClientMessageType = 2 // 设置消息的编码格式 FramebufferUpdateRequest ClientMessageType = 3 // 请求帧缓冲内容 KeyEvent ClientMessageType = 4 // 键盘事件消息 PointerEvent ClientMessageType = 5 // 鼠标事件消息 ClientCutText ClientMessageType = 6 // 剪切板消息 EnableContinuousUpdates ClientMessageType = 150 // 打开连续更新 ClientFence ClientMessageType = 248 //客户端到服务端的数据同步请求 SetDesktopSize ClientMessageType = 251 //客户端设置桌面大小 QEMUExtendedKeyEvent ClientMessageType = 255 // qumu虚拟机的扩展按键消息 )
func (ClientMessageType) String ¶
func (i ClientMessageType) String() string
type Color ¶
type Color struct {
R, G, B uint16
// contains filtered or unexported fields
}
Color 表示颜色地图中的一个颜色。
type EncodingType ¶
type EncodingType int32
const ( EncRaw EncodingType = 0 // 不编码,原始的格式 EncCopyRect EncodingType = 1 //从帧缓冲复制 EncRRE EncodingType = 2 // 二维游程编码 EncCoRRE EncodingType = 4 // 二维游程编码的变体 EncHexTile EncodingType = 5 // RRE 的变种,图块游程编码 EncZlib EncodingType = 6 // zlib压缩 EncTight EncodingType = 7 // tightvnc项目设置的编码 EncZlibHex EncodingType = 8 // zlib压缩Hextile EncUltra1 EncodingType = 9 EncUltra2 EncodingType = 10 EncTRLE EncodingType = 15 //图块游程编码 EncZRLE EncodingType = 16 //zlib 压缩的游程编码 EncH264 EncodingType = 20 EncJPEG EncodingType = 21 EncJRLE EncodingType = 22 EncAtenAST2100 EncodingType = 87 EncAtenASTJPEG EncodingType = 88 EncAtenHermon EncodingType = 89 EncAtenYarkon EncodingType = 90 EncAtenPilot3 EncodingType = 91 EncJPEGQualityLevelPseudo10 EncodingType = -23 EncJPEGQualityLevelPseudo9 EncodingType = -24 EncJPEGQualityLevelPseudo8 EncodingType = -25 EncJPEGQualityLevelPseudo7 EncodingType = -26 EncJPEGQualityLevelPseudo6 EncodingType = -27 EncJPEGQualityLevelPseudo5 EncodingType = -28 EncJPEGQualityLevelPseudo4 EncodingType = -29 EncJPEGQualityLevelPseudo3 EncodingType = -30 EncJPEGQualityLevelPseudo2 EncodingType = -31 EncJPEGQualityLevelPseudo1 EncodingType = -32 EncDesktopSizePseudo EncodingType = -223 //桌面分辨率伪编码 EncLastRectPseudo EncodingType = -224 // 表示是最后一个矩形的伪编码 EncPointerPosPseudo EncodingType = -232 EncCursorPseudo EncodingType = -239 //光标掩码 EncXCursorPseudo EncodingType = -240 EncCompressionLevel10 EncodingType = -247 EncCompressionLevel9 EncodingType = -248 EncCompressionLevel8 EncodingType = -249 EncCompressionLevel7 EncodingType = -250 EncCompressionLevel6 EncodingType = -251 EncCompressionLevel5 EncodingType = -252 EncCompressionLevel4 EncodingType = -253 EncCompressionLevel3 EncodingType = -254 EncCompressionLevel2 EncodingType = -255 EncCompressionLevel1 EncodingType = -256 EncQEMUPointerMotionChangePseudo EncodingType = -257 EncQEMUExtendedKeyEventPseudo EncodingType = -258 EncTightPng EncodingType = -260 EncLedStatePseudo EncodingType = -261 EncDesktopNamePseudo EncodingType = -307 EncExtendedDesktopSizePseudo EncodingType = -308 EncXvpPseudo EncodingType = -309 EncClientRedirect EncodingType = -311 EncFencePseudo EncodingType = -312 EncContinuousUpdatesPseudo EncodingType = -313 EncCursorWithAlphaPseudo EncodingType = -314 EncExtendedClipboardPseudo EncodingType = -1063131698 //C0A1E5CE EncTightPNGBase64 EncodingType = 21 + 0x574d5600 EncTightDiffComp EncodingType = 22 + 0x574d5600 EncVMWDefineCursor EncodingType = 100 + 0x574d5600 EncVMWCursorState EncodingType = 101 + 0x574d5600 EncVMWCursorPosition EncodingType = 102 + 0x574d5600 EncVMWTypematicInfo EncodingType = 103 + 0x574d5600 EncVMWLEDState EncodingType = 104 + 0x574d5600 EncVMWServerPush2 EncodingType = 123 + 0x574d5600 EncVMWServerCaps EncodingType = 122 + 0x574d5600 EncVMWFrameStamp EncodingType = 124 + 0x574d5600 EncOffscreenCopyRect EncodingType = 126 + 0x574d5600 )
func (EncodingType) String ¶
func (i EncodingType) String() string
type IEncoding ¶
type IEncoding interface { Type() EncodingType Supported(ISession) bool Clone(...bool) IEncoding Read(ISession, *Rectangle) error Write(ISession, *Rectangle) error }
IEncoding vnc像素数据编码格式的接口定义
type ISecurityHandler ¶
type ISecurityHandler interface { Type() SecurityType SubType() SecuritySubType Auth(ISession) error }
ISecurityHandler 认证方式的接口
type ISession ¶
type ISession interface { io.ReadWriteCloser Conn() io.ReadWriteCloser Start() Flush() error // 清空缓冲区 Wait() <-chan struct{} // 等待会话处理结束 Init(...Option) error Options() Options SetPixelFormat(PixelFormat) SetColorMap(ColorMap) SetWidth(uint16) SetHeight(uint16) SetDesktopName([]byte) ProtocolVersion() string // 获取当前的rfb协议 SetProtocolVersion(string) // 设置rfb协议 SetSecurityHandler(ISecurityHandler) // 设置安全认证处理方法 SecurityHandler() ISecurityHandler // 获取当前安全认证的处理方法 Encodings() []IEncoding // 获取该会话支持的图像编码类型 SetEncodings([]EncodingType) error // 设置该链接支持的图像编码类型 NewEncoding(EncodingType) IEncoding Swap() *gmap.Map // 获取会话的自定义存储数据 Type() SessionType }
ISession vnc连接的接口
type Key ¶
type Key uint32
const ( Space Key = iota + 0x0020 Exclaim // exclamation mark QuoteDbl NumberSign Dollar Percent Ampersand Apostrophe ParenLeft ParenRight Asterisk Plus Comma Minus Period Slash Digit0 Digit1 Digit2 Digit3 Digit4 Digit5 Digit6 Digit7 Digit8 Digit9 Colon Semicolon Less Equal Greater Question At A B C D E F G H I J K L M N O P Q R S T U V W X Y Z BracketLeft Backslash BracketRight AsciiCircum Underscore Grave SmallA SmallB SmallC SmallD SmallE SmallF SmallG SmallH SmallI SmallJ SmallK SmallL SmallM SmallN SmallO SmallP SmallQ SmallR SmallS SmallT SmallU SmallV SmallW SmallX SmallY SmallZ BraceLeft Bar BraceRight AsciiTilde )
Latin 1 (byte 3 = 0) ISO/IEC 8859-1 = Unicode U+0020..U+00FF
const ( KeypadF1 Key = iota + 0xff91 KeypadF2 KeypadF3 KeypadF4 KeypadHome KeypadLeft KeypadUp KeypadRight KeypadDown KeypadPrior KeypadPageUp KeypadNext KeypadPageDown KeypadEnd KeypadBegin KeypadInsert KeypadDelete KeypadMultiply KeypadAdd KeypadSeparator KeypadSubtract KeypadDecimal KeypadDivide Keypad0 Keypad1 Keypad2 Keypad3 Keypad4 Keypad5 Keypad6 Keypad7 Keypad8 Keypad9 KeypadEqual Key = 0xffbd )
type MessageType ¶ added in v1.1.0
type MessageType uint8
type Option ¶ added in v1.1.0
type Option func(*Options)
func OptDesktopName ¶ added in v1.1.0
func OptDisableClientMessageType ¶ added in v1.1.1
func OptDisableClientMessageType(opt ...ClientMessageType) Option
OptDisableClientMessageType 要屏蔽的客户端消息
func OptDisableServerMessageType ¶ added in v1.1.1
func OptDisableServerMessageType(opt ...ServerMessageType) Option
OptDisableServerMessageType 要屏蔽的服务端消息
func OptEncodings ¶ added in v1.1.0
OptEncodings 设置支持的编码格式
func OptPixelFormat ¶ added in v1.1.0
func OptPixelFormat(opt PixelFormat) Option
OptPixelFormat 设置像素格式
func OptSecurityHandlers ¶ added in v1.1.0
func OptSecurityHandlers(opt ...ISecurityHandler) Option
OptSecurityHandlers 设置权限认证处理程序
type Options ¶ added in v1.1.0
type Options struct { // 公共配置 Handlers []IHandler // 处理程序列表 SecurityHandlers []ISecurityHandler // 安全验证 Encodings []IEncoding // 支持的编码类型 PixelFormat PixelFormat // 像素格式 ColorMap ColorMap // 颜色地图 Input chan Message // 输入消息 Output chan Message // 输出消息 Messages []Message // 支持的消息类型 DisableServerMessageType []ServerMessageType // 禁用的消息,碰到这些消息,则跳过 DisableClientMessageType []ClientMessageType // 禁用的消息,碰到这些消息,则跳过 QuitCh chan struct{} // 退出 ErrorCh chan error // 错误通道 // 服务端配置 DesktopName []byte // 桌面名称,作为服务端配置的时候,需要设置 Height uint16 // 缓冲帧高度,作为服务端配置的时候,需要设置 Width uint16 // 缓冲帧宽度,作为服务端配置的时候,需要设置 // 客户端配置 DrawCursor bool // 是否绘制鼠标指针 Exclusive bool // 是否独占 // 生成连接的方法 GetConn GetConn }
Options 配置信息
type PixelFormat ¶
type PixelFormat struct { BPP uint8 // 1 byte,像素的位数,位数越大,色彩越丰富。只支持[8|16|32] 该值必须大于Depth Depth uint8 // 1 byte,色深,像素中表示色彩的位数 BigEndian uint8 // 1 byte,多字节像素的字节序,非零即大端序 TrueColor uint8 // 1 byte,1 表示真彩色,pixel 的值表示 RGB 颜色;0 表示调色板,pexel 的值表示颜色在调色板的偏移量 RedMax uint16 // 2 byte,红色的长度 GreenMax uint16 // 2 byte,绿色的长度 BlueMax uint16 // 2 byte,蓝色的长度 RedShift uint8 // 1 byte,红色的位移量 GreenShift uint8 // 1 byte,绿色的位移量 BlueShift uint8 // 1 byte,蓝色的偏移量 // contains filtered or unexported fields }
PixelFormat 像素格式结构体
func NewPixelFormat ¶
func NewPixelFormat(bpp uint8) PixelFormat
func NewPixelFormatAten ¶
func NewPixelFormatAten() PixelFormat
func (PixelFormat) Order ¶
func (that PixelFormat) Order() binary.ByteOrder
Order 确定像素格式是使用了大端字节序还是小端字节序
func (PixelFormat) String ¶
func (that PixelFormat) String() string
type Rectangle ¶
type Rectangle struct { X uint16 Y uint16 Width uint16 Height uint16 EncType EncodingType Enc IEncoding }
Rectangle 表示像素数据的矩形
func NewRectangle ¶
func NewRectangle() *Rectangle
type SecuritySubType ¶
type SecuritySubType uint32
SecuritySubType 认证子类型
const ( SecSubTypeVeNCrypt01Unknown SecuritySubType = SecuritySubType(0) SecSubTypeVeNCrypt01Plain SecuritySubType = SecuritySubType(19) SecSubTypeVeNCrypt01TLSNone SecuritySubType = SecuritySubType(20) SecSubTypeVeNCrypt01TLSVNC SecuritySubType = SecuritySubType(21) SecSubTypeVeNCrypt01TLSPlain SecuritySubType = SecuritySubType(22) SecSubTypeVeNCrypt01X509None SecuritySubType = SecuritySubType(23) SecSubTypeVeNCrypt01X509VNC SecuritySubType = SecuritySubType(24) SecSubTypeVeNCrypt01X509Plain SecuritySubType = SecuritySubType(25) )
VeNCrypt 安全认证会有两种认证版本0.1和0.2 以下表示0.1
const ( SecSubTypeVeNCrypt02Unknown SecuritySubType = SecuritySubType(0) SecSubTypeVeNCrypt02Plain SecuritySubType = SecuritySubType(256) SecSubTypeVeNCrypt02TLSNone SecuritySubType = SecuritySubType(257) SecSubTypeVeNCrypt02TLSVNC SecuritySubType = SecuritySubType(258) SecSubTypeVeNCrypt02TLSPlain SecuritySubType = SecuritySubType(259) SecSubTypeVeNCrypt02X509None SecuritySubType = SecuritySubType(260) SecSubTypeVeNCrypt02X509VNC SecuritySubType = SecuritySubType(261) SecSubTypeVeNCrypt02X509Plain SecuritySubType = SecuritySubType(262) )
以下表示0.2版本的类型
const (
SecSubTypeUnknown SecuritySubType = SecuritySubType(0)
)
SecSubTypeUnknown 未知的子类型认证
func (SecuritySubType) String ¶
func (i SecuritySubType) String() string
type SecurityType ¶
type SecurityType uint8
SecurityType 安全认证类型
const ( SecTypeUnknown SecurityType = SecurityType(0) // 未知认证类型 SecTypeNone SecurityType = SecurityType(1) // 不需要认证 SecTypeVNC SecurityType = SecurityType(2) // vnc密码认证 SecTypeTight SecurityType = SecurityType(16) // tight vnc主导的认证模式 SecTypeVeNCrypt SecurityType = SecurityType(19) // VeNCrypt 通用认证类型 )
func (SecurityType) String ¶
func (i SecurityType) String() string
type ServerMessageType ¶
type ServerMessageType MessageType
ServerMessageType 服务端发送给客户端的消息类型
const ( FramebufferUpdate ServerMessageType = 0 // 帧缓冲区更新消息 SetColorMapEntries ServerMessageType = 1 // 设置颜色地图 Bell ServerMessageType = 2 // 响铃 ServerCutText ServerMessageType = 3 // 设置剪切板数据 EndOfContinuousUpdates ServerMessageType = 150 //结束连续更新 ServerFence ServerMessageType = 248 //支持 Fence 扩展的服务器发送此扩展以请求数据流的同步 )
func (ServerMessageType) String ¶
func (i ServerMessageType) String() string
type SessionType ¶
type SessionType uint8
const ( ClientSessionType SessionType = 0 ServerSessionType SessionType = 1 RecorderSessionType SessionType = 2 PlayerSessionType SessionType = 3 CanvasSessionType SessionType = 4 )
func (SessionType) String ¶
func (i SessionType) String() string
type TargetConfig ¶
type TargetConfig struct { Network string // 网络协议 Timeout time.Duration // 超时时间 Host string // vnc服务端地址 Port int // vnc服务端端口 Password []byte // vnc服务端密码 }
func (TargetConfig) Addr ¶
func (that TargetConfig) Addr() string
func (TargetConfig) GetNetwork ¶ added in v1.1.0
func (that TargetConfig) GetNetwork() string
func (TargetConfig) GetTimeout ¶ added in v1.1.0
func (that TargetConfig) GetTimeout() time.Duration
Source Files ¶
- color_map.go
- desktop.go
- encoding.go
- encodingtype.go
- encodingtype_string.go
- handler.go
- keys.go
- keys_string.go
- message.go
- message_type_client_string.go
- message_type_server_string.go
- messagetype.go
- options.go
- pixel_format.go
- rectangle.go
- security.go
- securitysubtype_string.go
- securitytype_string.go
- session.go
- session_string.go
- target_config.go
Click to show internal directories.
Click to hide internal directories.