gui

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gui finds the remote-desktop port a running cell publishes and builds the URLs and client arguments `cell rdp` and `cell vnc` open it with.

Discovery is the same for both protocols and is parameterized by Protocol. Viewer-specific helpers live in rdp.go (FreeRDP, Royal TSX, xrdp cert) and vnc.go (VNC password file, Screen Sharing and Royal TSX URLs).

Index

Constants

View Source
const TartVNCPassword = "admin"

TartVNCPassword is the macOS user password set for ARD Screen Sharing auth in Tart VMs. Matches the password set by GenerateCreateSessionUserScript (provision.go) and hosts/macos/default.nix.

Variables

This section is empty.

Functions

func CertFingerprint

func CertFingerprint(configDir string) string

CertFingerprint reads the xrdp server cert from configDir/xrdp/cert.pem and returns its SHA256 fingerprint as a hex string (colon-separated). Returns empty string if the cert doesn't exist or can't be parsed.

func CertFlag

func CertFlag(configDir string) string

CertFlag returns the FreeRDP /cert: flag. Uses fingerprint verification if the cert exists, otherwise falls back to /cert:ignore.

func HasRoyalTSX

func HasRoyalTSX() bool

HasRoyalTSX checks if Royal TSX is installed on macOS.

func InstallHint

func InstallHint() string

InstallHint returns platform-specific install instructions for FreeRDP.

func RDPUrl

func RDPUrl(host, port string) string

RDPUrl returns an RDP URL for the given host and port. Uses percent-encoded format required by macOS Sonoma+ Windows App:

rdp://full%20address=s%3A<host>%3A<port>

func RoyalTSXUrl

func RoyalTSXUrl(host, port, user, password string) string

RoyalTSXUrl returns a Royal TSX URI for the given host, port and credentials. Note: macOS Royal TSX does not support property_* query params in adhoc URIs. Retina must be enabled via Application → Default Settings → Remote Desktop → Display.

func RoyalTSXVNCUrl

func RoyalTSXVNCUrl(host, port, user, password string) string

RoyalTSXVNCUrl returns a Royal TSX URI for a VNC connection.

func VNCPasswdFile

func VNCPasswdFile() string

VNCPasswdFile returns the path to a VNC password file containing the encrypted password "vnc". Creates the file on first call.

func VNCUrl

func VNCUrl(host, port, user, password string) string

VNCUrl returns a VNC URL for macOS Screen Sharing. user="" uses VNC legacy auth (password only); non-empty uses ARD auth.

Types

type CellEndpoint

type CellEndpoint struct {
	Host   string // "127.0.0.1" for Docker/WinKit, VM IP for Tart
	Port   string
	Engine string // "docker", "winkit", "tart"
	User   string // ARD auth user for tart (host $USER); empty for other engines
}

CellEndpoint is the address of a running cell's remote-desktop server.

func (CellEndpoint) Addr

func (e CellEndpoint) Addr() string

Addr returns "host:port".

type ClientBinary

type ClientBinary struct {
	Path string // absolute path from LookPath
	Name string // binary name (e.g. "sdl-freerdp3")
}

ClientBinary holds the resolved FreeRDP binary path and name.

func FindClient

func FindClient() (ClientBinary, bool)

FindClient finds the best available FreeRDP client binary for the current platform.

func FindClientWith

func FindClientWith(goos string, lookPath func(string) (string, error)) (ClientBinary, bool)

FindClientWith is like FindClient but accepts explicit OS and lookPath for testing.

type Protocol

type Protocol string

Protocol is a remote-desktop protocol a cell serves its desktop over.

const (
	RDP Protocol = "rdp"
	VNC Protocol = "vnc"
)

func (Protocol) ContainerPort

func (p Protocol) ContainerPort() string

ContainerPort returns the port the protocol's server listens on inside a cell: "3389" for RDP, "5900" for VNC.

func (Protocol) Label

func (p Protocol) Label() string

Label returns the protocol name as users see it: "RDP" or "VNC".

func (Protocol) ParseDockerPS

func (p Protocol) ParseDockerPS(output string) (map[string]string, error)

ParseDockerPS parses the output of:

docker ps --filter "name=cell-" --format "{{.Names}}\t{{.Ports}}"

and returns a map of cell name to the host port published for p. Containers that do not publish p's port are skipped.

func (Protocol) ParseInspectPort

func (p Protocol) ParseInspectPort(inspectJSON string) (string, error)

ParseInspectPort extracts the host port published for p's container port from docker inspect JSON output.

func (Protocol) PortEnv

func (p Protocol) PortEnv() string

PortEnv returns the env var devcell sets inside a cell to the published host port: EXT_RDP_PORT or EXT_VNC_PORT.

func (Protocol) URL

func (p Protocol) URL(ep CellEndpoint) string

URL returns the connection URL for a cell endpoint. Tart macOS VMs use ARD auth (ep.User:admin); other engines use legacy VNC.

Jump to

Keyboard shortcuts

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