代码拉取完成,页面将自动刷新
// Common things that aren't part of the RFB protocol.
package vnc
import (
"bytes"
"encoding/binary"
"fmt"
"time"
)
// VNCError implements error interface.
type VNCError struct {
desc string
}
// NewVNCError returns a custom VNCError error.
func NewVNCError(desc string) error {
return &VNCError{desc}
}
// Error returns an VNCError as a string.
func (e VNCError) Error() string {
return e.desc
}
func Errorf(format string, a ...interface{}) error {
return &VNCError{
desc: fmt.Sprintf(format, a...),
}
}
var settleDuration = 25 * time.Millisecond
// Settle returns the UI settle duration.
func Settle() time.Duration {
return settleDuration
}
// SetSettle changes the UI settle duration.
func SetSettle(s time.Duration) {
settleDuration = s
}
// settleUI allows the UI to "settle" before the next UI change is made.
func settleUI() {
time.Sleep(settleDuration)
}
type Buffer struct {
buf *bytes.Buffer // byte stream
}
func NewBuffer(b []byte) *Buffer {
return &Buffer{buf: bytes.NewBuffer(b)}
}
func (b *Buffer) Bytes() []byte {
return b.buf.Bytes()
}
func (b *Buffer) Read(data interface{}) error {
return binary.Read(b.buf, binary.BigEndian, data)
}
func (b *Buffer) Write(data interface{}) error {
return binary.Write(b.buf, binary.BigEndian, data)
}
func (b *Buffer) WriteByte(c byte) error {
return b.buf.WriteByte(c)
}
// Marshaler is the interface satisfied for marshaling messages.
type Marshaler interface {
// Marshal returns the wire encoding of a message.
Marshal() ([]byte, error)
}
// Unarshaler is the interface satisfied for unmarshaling messages.
type Unmarshaler interface {
// Unmarshal parses a wire format message into a message.
Unmarshal(data []byte) error
}
// MarshalerUnmarshaler satisfies both the Marshaler and Unmarshaler interfaces.
type MarshalerUnmarshaler interface {
Marshaler
Unmarshaler
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。