client

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: GPL-3.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

client.go

rfb.go

Index

Constants

View Source
const (
	CLIP_OFF = 0
	CLIP_IN  = 0x1
	CLIP_OUT = 0x2
)
View Source
const (
	TC_RDP = 0
	TC_VNC = 1
)
View Source
const DefaultLoginTimeout = 30 * time.Second

DefaultLoginTimeout bounds how long Login waits for the RDP session to become ready after the transport handshake succeeds.

Variables

This section is empty.

Functions

func Bpp

func Bpp(bp uint16) int

Types

type Bitmap

type Bitmap struct {
	DestLeft     int    `json:"destLeft"`
	DestTop      int    `json:"destTop"`
	DestRight    int    `json:"destRight"`
	DestBottom   int    `json:"destBottom"`
	Width        int    `json:"width"`
	Height       int    `json:"height"`
	BitsPerPixel int    `json:"bitsPerPixel"`
	IsCompress   bool   `json:"isCompress"`
	Data         []byte `json:"data"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host, user, passwd string, t int, s *Setting) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) KeyDown

func (c *Client) KeyDown(sc int, name string)

func (*Client) KeyUp

func (c *Client) KeyUp(sc int, name string)

func (*Client) Login

func (c *Client) Login() error

Login connects and waits until the session is ready (or fails/times out).

func (*Client) LoginContext

func (c *Client) LoginContext(ctx context.Context) error

LoginContext is Login with an explicit context. It returns only once the server has completed the connection sequence and the session is ready, or when the handshake fails, the connection is closed, or ctx expires.

func (*Client) MouseDown

func (c *Client) MouseDown(button, x, y int)

func (*Client) MouseMove

func (c *Client) MouseMove(x, y int)

func (*Client) MouseUp

func (c *Client) MouseUp(button, x, y int)

func (*Client) MouseWheel

func (c *Client) MouseWheel(scroll, x, y int)

func (*Client) OnBitmap

func (c *Client) OnBitmap(f func([]Bitmap))

func (*Client) OnClipboardText

func (c *Client) OnClipboardText(f func(text string))

OnClipboardText reports text the server has put on the clipboard. It only fires when the clipboard channel is enabled.

func (*Client) OnClose

func (c *Client) OnClose(f func())

func (*Client) OnError

func (c *Client) OnError(f func(e error))

func (*Client) OnOrdersFrame added in v0.3.0

func (c *Client) OnOrdersFrame(f func(dirty image.Rectangle))

OnOrdersFrame reports that a batch of drawing orders changed the screen, giving the area that changed. The pixels are in Client.Screen.

func (*Client) OnPointer

func (c *Client) OnPointer(f func(p *pdu.PointerDataPDU))

OnPointer reports slow-path pointer updates (PDUTYPE2_POINTER), which carry either a new position or a pointer shape.

func (*Client) OnPointerPosition

func (c *Client) OnPointerPosition(f func(x, y int))

OnPointerPosition reports the server-side pointer position (fast-path FASTPATH_UPDATETYPE_PTR_POSITION). It is useful to confirm that mouse input reached the remote session.

func (*Client) OnReady

func (c *Client) OnReady(f func())

func (*Client) OnSuccess

func (c *Client) OnSuccess(f func())

func (*Client) OnSurfaceFrame

func (c *Client) OnSurfaceFrame(f func(frameID uint32, surfaces []*rdpgfx.Surface))

OnSurfaceFrame reports each completed EGFX frame and the surfaces it touched. The pixel data lives on the surfaces, so callers that need it should copy what they need before returning.

func (*Client) OnSurfaceReset

func (c *Client) OnSurfaceReset(f func(width, height int))

OnSurfaceReset reports the desktop size an EGFX server will composite into, which also means any previously known surfaces are gone.

func (*Client) RequestClipboardText

func (c *Client) RequestClipboardText() error

RequestClipboardText asks the server for the clipboard text it last announced. OnClipboardText normally triggers this by itself, but a server can announce a format before it is able to serve it, in which case an explicit request made later is what gets the data.

func (*Client) Screen added in v0.3.0

func (c *Client) Screen() *orders.Screen

Screen returns the framebuffer that drawing orders are rendered into, or nil when Setting.EnableOrders was not set. It holds BGRA pixels, top down, and is safe to read while the connection is running.

func (*Client) SetClipboardText

func (c *Client) SetClipboardText(text string) error

SetClipboardText publishes text on the shared clipboard, so a paste on the server pastes it. It only does anything when the clipboard channel is enabled.

type Control

type Control interface {
	Login(host, user, passwd string, width, height int) error
	KeyUp(sc int, name string)
	KeyDown(sc int, name string)
	MouseMove(x, y int)
	MouseWheel(scroll, x, y int)
	MouseUp(button int, x, y int)
	MouseDown(button int, x, y int)
	On(event string, msg interface{})
	SetClipboardText(text string) error
	RequestClipboardText() error
	Close()
}

type RdpClient

type RdpClient struct {
	// contains filtered or unexported fields
}

func (*RdpClient) Close

func (c *RdpClient) Close()

func (*RdpClient) KeyDown

func (c *RdpClient) KeyDown(sc int, name string)

func (*RdpClient) KeyUp

func (c *RdpClient) KeyUp(sc int, name string)

func (*RdpClient) Login

func (c *RdpClient) Login(host, user, pwd string, width, height int) error

func (*RdpClient) MouseDown

func (c *RdpClient) MouseDown(button int, x, y int)

func (*RdpClient) MouseMove

func (c *RdpClient) MouseMove(x, y int)

func (*RdpClient) MouseUp

func (c *RdpClient) MouseUp(button int, x, y int)

func (*RdpClient) MouseWheel

func (c *RdpClient) MouseWheel(scroll, x, y int)

func (*RdpClient) On

func (c *RdpClient) On(event string, f interface{})

func (*RdpClient) RequestClipboardText

func (c *RdpClient) RequestClipboardText() error

RequestClipboardText asks the server for its clipboard text.

func (*RdpClient) SetClipboardText

func (c *RdpClient) SetClipboardText(text string) error

SetClipboardText publishes text on the shared clipboard.

type Setting

type Setting struct {
	Width    int
	Height   int
	Protocol string
	Timeout  time.Duration
	LogLevel glog.LEVEL
	// NoFastPathInput forces keyboard/mouse input over the slow path even
	// when the server advertised fast-path input. Useful for debugging.
	NoFastPathInput bool

	// EnableEGFX opens the dynamic virtual channel needed for the RDP
	// Graphics Pipeline Extension, so the server can composite surfaces and
	// send them as compressed bitmaps instead of bitmap updates.
	//
	// This is off by default: it has not been exercised against a server that
	// speaks EGFX, and enabling it changes how the server draws the session.
	EnableEGFX bool

	// EnableClipboard opens the clipboard channel so text can be exchanged
	// with the server. Use Client.OnClipboardText and Client.SetClipboardText
	// to bridge it to the local clipboard.
	EnableClipboard bool

	// EnableOrders advertises support for the MEMBLT drawing order and renders
	// the drawing orders that follow, into a framebuffer reachable through
	// Client.Screen.
	//
	// It is off by default because it changes how the server draws the session
	// and it cannot mix: once MEMBLT is advertised the server stops sending
	// bitmap updates and puts everything through the bitmap cache instead. With
	// it off the session is drawn from bitmap updates, which is correct, just
	// larger on the wire.
	EnableOrders bool
}

func NewSetting

func NewSetting() *Setting

func (*Setting) SetClipboard

func (s *Setting) SetClipboard(c int)

func (*Setting) SetLogLevel

func (s *Setting) SetLogLevel()

func (*Setting) SetRequestedProtocol

func (s *Setting) SetRequestedProtocol(p uint32)

type VncClient

type VncClient struct {
	// contains filtered or unexported fields
}

func (*VncClient) Close

func (c *VncClient) Close()

func (*VncClient) KeyDown

func (c *VncClient) KeyDown(sc int, name string)

func (*VncClient) KeyUp

func (c *VncClient) KeyUp(sc int, name string)

func (*VncClient) Login

func (c *VncClient) Login(host, user, pwd string, width, height int) error

func (*VncClient) MouseDown

func (c *VncClient) MouseDown(button int, x, y int)

func (*VncClient) MouseMove

func (c *VncClient) MouseMove(x, y int)

func (*VncClient) MouseUp

func (c *VncClient) MouseUp(button int, x, y int)

func (*VncClient) MouseWheel

func (c *VncClient) MouseWheel(scroll, x, y int)

func (*VncClient) On

func (c *VncClient) On(event string, f interface{})

func (*VncClient) RequestClipboardText

func (c *VncClient) RequestClipboardText() error

RequestClipboardText is not implemented for RFB.

func (*VncClient) SetClipboardText

func (c *VncClient) SetClipboardText(string) error

SetClipboardText is not implemented for RFB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL