Documentation
¶
Overview ¶
Package vboxweb performs absolute mouse clicks against a running VM by talking SOAP to the VirtualBox web service (vboxwebsrv). This replaces the upstream project's Python (vboxapi) helper, keeping the server a single Go binary with no external runtime.
VBoxManage has no CLI command for mouse events, so the Main API is the only way to drive the guest pointer. Reaching it from Go without cgo/XPCOM means using the web service. The service is started automatically on demand the first time a mouse click is needed (see ensureStarted); no manual setup is required in the default configuration.
Configuration via environment:
VBOXWEB_ENDPOINT service URL (default http://127.0.0.1:18083/) VBOXWEB_USER logon username (default empty -> anonymous/null auth) VBOXWEB_PASSWORD logon password (default empty) VBOXWEB_AUTOSTART "false" to disable auto-starting vboxwebsrv VBOXWEB_BIN path to the vboxwebsrv binary (else derived/PATH)
Index ¶
- type Client
- func (c *Client) Click(ctx context.Context, vm string, x, y int, button string, double bool) error
- func (c *Client) Drag(ctx context.Context, vm string, x1, y1, x2, y2 int, button string) error
- func (c *Client) Move(ctx context.Context, vm string, x, y int) error
- func (c *Client) Scroll(ctx context.Context, vm string, x, y, dz, dw int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a vboxwebsrv SOAP endpoint and can start the service on demand.
func NewFromEnv ¶
NewFromEnv builds a Client from the VBOXWEB_* environment variables. vboxManagePath is used to locate vboxwebsrv (installed alongside it) and to set the web service to anonymous auth on first auto-start.
func (*Client) Click ¶
Click moves the absolute pointer to (x, y) and presses/releases button. When double is true it issues a second press/release. The VM must have USB tablet mouse mode enabled (vm_create does this) for absolute positioning to work.
If the web service is unreachable and autostart is enabled, Click starts vboxwebsrv on demand and retries once.
func (*Client) Drag ¶
Drag presses button at (x1, y1), moves to (x2, y2) in steps while held, then releases. Intermediate moves make the drag register with the guest.