hostdesktop

package
v0.23.9 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceUnsupported   = "unsupported"
	ServiceNotInstalled  = "not_installed"
	ServiceAuthorization = "authorization_required"
	ServiceInstalling    = "installing"
	ServiceActive        = "active"
	ServiceStopped       = "stopped"
	ServiceFailed        = "failed"
	ServiceUninstalling  = "uninstalling"
)
View Source
const HostDesktopDefaultFrameWindow = 4

An absent window preserves the original protocol's four-frame limit. Extended delivery requires an explicit capability and matching picture offer.

View Source
const HostDesktopMaxFrameWindow = 6
View Source
const HostDesktopProtocolVersion = 1

Physical desktop sessions are independent of private application desktops. Consumers authorize a session; native adapters own its current OS target.

View Source
const LoginScreenService = "login-screen"
View Source
const LoginServiceManagementVersion = 2
View Source
const LoginServiceSocket = "/run/redeven-desktop/desktop.sock"

Variables

View Source
var (
	ErrServiceUnsupported    = errors.New("login-screen service is unsupported")
	ErrServiceAuthorization  = errors.New("administrator authorization is required")
	ErrServiceNotInstalled   = errors.New("login-screen service is not installed")
	ErrServiceUpdateRequired = errors.New("desktop service update required")
)
View Source
var ErrHostDesktopProtocol = errors.New("invalid host desktop protocol")

Functions

func RunLoginDisplayPower

func RunLoginDisplayPower(ctx context.Context) error

RunLoginDisplayPower is a fixed child operation, never a renderer-selected command. The daemon changes credentials before starting this copy of itself; all inherited capabilities are removed before contacting the user session bus. Mutter's PowerSaveMode wakes display output without unlocking or injecting input, and -1 explicitly means unsupported and must never be changed.

func RunLoginMediaPython added in v0.22.28

func RunLoginMediaPython(root, worker string) error

RunLoginMediaPython executes only the immutable installation selected by the daemon. Thread pinning keeps capability removal and exec on the same thread.

func RunLoginScreenService

func RunLoginScreenService(ctx context.Context, config LoginServiceConfig) error

func RunLoginServiceManagement added in v0.23.0

func RunLoginServiceManagement(parent context.Context, input io.Reader, output io.Writer) int

RunLoginServiceManagement owns one bounded transaction. Typed stdin never contains credentials. A heartbeat loss cancels even through a PTY.

func RunLoginTextPython added in v0.22.33

func RunLoginTextPython(root, session, compositor string) error

func VerifyLoginServiceAdmission added in v0.23.0

func VerifyLoginServiceAdmission(ctx context.Context, path string, proof LoginServiceAdmissionProof) (string, error)

VerifyLoginServiceAdmission authenticates from the calling Runtime process. It does not open an attachment, inspect a display or request Portal consent.

func WriteHostDesktopCommand

func WriteHostDesktopCommand(writer io.Writer, command HostDesktopCommand) error

WriteHostDesktopCommand writes one validated native command. It never retries a partial input write; its caller must revoke that connection on an error.

func WriteHostDesktopMessage

func WriteHostDesktopMessage(writer io.Writer, message HostDesktopMessage) error

Types

type HostDesktopCapabilities

type HostDesktopCapabilities struct {
	FrameWindow   int                  `json:"frame_window,omitempty"`
	Authorization string               `json:"authorization,omitempty"`
	Backend       string               `json:"backend"`
	State         string               `json:"state"`
	Reason        string               `json:"reason,omitempty"`
	Screen        bool                 `json:"screen"`
	Input         bool                 `json:"input"`
	Clipboard     bool                 `json:"clipboard"`
	TextInput     bool                 `json:"text_input,omitempty"`
	Audio         bool                 `json:"audio"`
	Unattended    bool                 `json:"unattended"`
	Unlock        bool                 `json:"unlock"`
	LockedScreen  bool                 `json:"locked_screen,omitempty"`
	Service       string               `json:"service,omitempty"`
	Encoder       string               `json:"encoder,omitempty"`
	Displays      []HostDesktopDisplay `json:"displays"`
}

type HostDesktopCommand

type HostDesktopCommand struct {
	Version    int                 `json:"version"`
	ID         uint64              `json:"id"`
	Method     string              `json:"method"`
	Generation uint64              `json:"generation,omitempty"`
	FrameID    uint64              `json:"frame_id,omitempty"`
	DisplayID  string              `json:"display_id,omitempty"`
	Mode       string              `json:"mode,omitempty"`
	Unattended bool                `json:"unattended,omitempty"`
	Picture    *HostDesktopPicture `json:"picture,omitempty"`
	Input      *HostDesktopInput   `json:"input,omitempty"`
	Text       *string             `json:"text,omitempty"`
	Enabled    *bool               `json:"enabled,omitempty"`
	Service    string              `json:"service,omitempty"`
}

func ParseHostDesktopCommand

func ParseHostDesktopCommand(data []byte) (HostDesktopCommand, error)

func (HostDesktopCommand) Valid

func (command HostDesktopCommand) Valid() bool

type HostDesktopCursorPosition added in v0.22.28

type HostDesktopCursorPosition struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

Cursor positions name the image's top-left in physical capture coordinates, not a guessed click hotspot or a compositor's logical desktop coordinates.

type HostDesktopDisplay

type HostDesktopDisplay struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	X       int     `json:"x"`
	Y       int     `json:"y"`
	Width   int     `json:"width"`
	Height  int     `json:"height"`
	Scale   float64 `json:"scale"`
	Primary bool    `json:"primary"`
}

type HostDesktopInput

type HostDesktopInput struct {
	Kind     string  `json:"kind"`
	X        float64 `json:"x"`
	Y        float64 `json:"y"`
	DX       float64 `json:"dx"`
	DY       float64 `json:"dy"`
	Button   int     `json:"button,omitempty"`
	Clicks   int     `json:"clicks,omitempty"`
	Key      string  `json:"key,omitempty"`
	Code     string  `json:"code,omitempty"`
	Pressed  bool    `json:"pressed,omitempty"`
	Repeat   bool    `json:"repeat,omitempty"`
	Location int     `json:"location,omitempty"`
	Shift    bool    `json:"shiftKey,omitempty"`
	Control  bool    `json:"ctrlKey,omitempty"`
	Alt      bool    `json:"altKey,omitempty"`
	Meta     bool    `json:"metaKey,omitempty"`
	Text     string  `json:"text,omitempty"`
}

HostDesktopInput uses normalized selected-display coordinates. Code names are physical KeyboardEvent.code names; text and clipboard are explicit operations.

type HostDesktopMessage

type HostDesktopMessage struct {
	Authorization  string                     `json:"authorization,omitempty"`
	Version        int                        `json:"version"`
	Type           string                     `json:"type"`
	ID             uint64                     `json:"id,omitempty"`
	Code           string                     `json:"code,omitempty"`
	State          string                     `json:"state,omitempty"`
	Mode           string                     `json:"mode,omitempty"`
	Capabilities   *HostDesktopCapabilities   `json:"capabilities,omitempty"`
	Service        string                     `json:"service,omitempty"`
	ServiceStatus  *HostDesktopServiceStatus  `json:"service_status,omitempty"`
	Displays       []HostDesktopDisplay       `json:"displays,omitempty"`
	DisplayID      string                     `json:"display_id,omitempty"`
	Generation     uint64                     `json:"generation,omitempty"`
	FrameID        uint64                     `json:"frame_id,omitempty"`
	Timestamp      int64                      `json:"timestamp,omitempty"`
	Codec          string                     `json:"codec,omitempty"`
	Profile        string                     `json:"profile,omitempty"`
	Description    string                     `json:"description,omitempty"`
	Encoder        string                     `json:"encoder,omitempty"`
	Cursor         string                     `json:"cursor,omitempty"`
	CursorPosition *HostDesktopCursorPosition `json:"cursor_position,omitempty"`
	CursorVisible  *bool                      `json:"cursor_visible,omitempty"`
	HotspotValid   *bool                      `json:"hotspot_valid,omitempty"`
	Width          int                        `json:"width,omitempty"`
	Height         int                        `json:"height,omitempty"`
	HotX           int                        `json:"hot_x,omitempty"`
	HotY           int                        `json:"hot_y,omitempty"`
	Key            bool                       `json:"key,omitempty"`
	SampleRate     int                        `json:"sample_rate,omitempty"`
	Channels       int                        `json:"channels,omitempty"`
	Text           *string                    `json:"text,omitempty"`
	Bytes          int                        `json:"bytes,omitempty"`
	Data           []byte                     `json:"-"`
}

HostDesktopMessage carries control metadata or one encoded media packet. Data is binary on media transports; credentials and content are not diagnostics.

func ReadHostDesktopMessage

func ReadHostDesktopMessage(reader io.Reader) (HostDesktopMessage, error)

ReadHostDesktopMessage reads bounded native framing without starting a helper, owning a session, retrying input or granting paint acknowledgement.

type HostDesktopPicture

type HostDesktopPicture struct {
	FrameWindow  int      `json:"frame_window,omitempty"`
	Mode         string   `json:"mode"`
	MaxDimension int      `json:"max_dimension"`
	FrameRate    int      `json:"frame_rate"`
	Audio        bool     `json:"audio"`
	NativePixels bool     `json:"native_pixels,omitempty"`
	Codecs       []string `json:"codecs,omitempty"`
}

func (HostDesktopPicture) FrameCapacity added in v0.22.48

func (p HostDesktopPicture) FrameCapacity() int

FrameCapacity resolves an omitted protocol-v1 offer to the legacy window.

type HostDesktopServiceStatus

type HostDesktopServiceStatus struct {
	State   string `json:"state"`
	Reason  string `json:"reason,omitempty"`
	Backend string `json:"backend,omitempty"`
}

HostDesktopServiceStatus is the stable, redacted status of the optional login-screen service. It intentionally contains no installation path or credential material.

type LoginScreenConnection

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

LoginScreenConnection is the existing physical-desktop protocol carried over the local service socket. Authentication is a short-lived, single-use ticket tied to the live Runtime UID, PID, start time and administrator-pinned image. Close revokes the attachment, releasing its held kernel input devices.

func OpenLoginScreenSession

func OpenLoginScreenSession(ctx context.Context, path string) (*LoginScreenConnection, error)

func (*LoginScreenConnection) Close

func (c *LoginScreenConnection) Close() error

func (*LoginScreenConnection) Control

func (c *LoginScreenConnection) Control() <-chan HostDesktopMessage

func (*LoginScreenConnection) Done

func (c *LoginScreenConnection) Done() <-chan struct{}

func (*LoginScreenConnection) Media

func (c *LoginScreenConnection) Media() <-chan HostDesktopMessage

func (*LoginScreenConnection) Send

func (c *LoginScreenConnection) Send(command HostDesktopCommand, _ bool) error

type LoginServiceAdmissionProof added in v0.23.2

type LoginServiceAdmissionProof struct {
	OperationID  string `json:"operation_id"`
	ChallengeID  string `json:"challenge_id"`
	PolicyDigest string `json:"policy_digest"`
}

type LoginServiceConfig

type LoginServiceConfig struct {
	SocketPath             string
	WorkerPath             string
	MediaRoot              string
	RuntimeUID, RuntimeGID uint32
	RuntimeSHA256          string
	PolicyDigest           string
	DeploymentJournal      string
	Seat                   string
}

LoginServiceConfig contains administrator-installed, root-owned policy only. It is never populated from a viewer request. No credential belongs here.

type LoginServiceDeploymentCommand added in v0.23.0

type LoginServiceDeploymentCommand struct {
	Version      int    `json:"version"`
	OperationID  string `json:"operation_id"`
	Action       string `json:"action"`
	ChallengeID  string `json:"challenge_id,omitempty"`
	PolicyDigest string `json:"policy_digest,omitempty"`
}

type LoginServiceDeploymentControl added in v0.23.0

type LoginServiceDeploymentControl func(context.Context, LoginServiceDeploymentEvent) error

Control waits for confirmation or authenticated Runtime proof. An error cancels the single manager-owned transaction; credentials never belong here.

type LoginServiceDeploymentEvent

type LoginServiceDeploymentEvent struct {
	Stage             string `json:"stage"`
	Code              string `json:"code,omitempty"`
	Rollback          string `json:"rollback,omitempty"`
	OperationID       string `json:"operation_id,omitempty"`
	ChallengeID       string `json:"challenge_id,omitempty"`
	ServiceGeneration string `json:"service_generation,omitempty"`
	PolicyDigest      string `json:"policy_digest,omitempty"`
	ActiveConnections *int   `json:"active_connections,omitempty"`
}

type LoginServiceDeploymentRequest

type LoginServiceDeploymentRequest struct {
	Operation       string `json:"operation"`
	SourceDirectory string `json:"source_directory,omitempty"`
	RuntimeUID      uint32 `json:"runtime_uid,omitempty"`
	RuntimeGID      uint32 `json:"runtime_gid,omitempty"`
	RuntimeSHA256   string `json:"runtime_sha256,omitempty"`
	ServiceSHA256   string `json:"service_sha256,omitempty"`
	WorkerSHA256    string `json:"worker_sha256,omitempty"`
	MediaSHA256     string `json:"media_sha256,omitempty"`
	Version         int    `json:"version,omitempty"`
	OperationID     string `json:"operation_id,omitempty"`
	RuntimePID      uint32 `json:"runtime_pid,omitempty"`
	RuntimeStart    string `json:"runtime_start,omitempty"`
}

LoginServiceDeploymentRequest is resolved by the trusted SSH adapter after explicit authorization. The manager is already privileged and never elevates.

type LoginServicePolicy added in v0.23.0

type LoginServicePolicy struct {
	RuntimeUID    uint32 `json:"runtime_uid,omitempty"`
	RuntimeGID    uint32 `json:"runtime_gid,omitempty"`
	RuntimeSHA256 string `json:"runtime_sha256,omitempty"`
	ServiceSHA256 string `json:"service_sha256,omitempty"`
	WorkerSHA256  string `json:"worker_sha256,omitempty"`
	MediaSHA256   string `json:"media_sha256,omitempty"`
}

LoginServicePolicy is the persistent administrator-owned allowlist.

type ServiceStatus

type ServiceStatus = HostDesktopServiceStatus

func InstalledLoginServiceStatus

func InstalledLoginServiceStatus(ctx context.Context, path string) (ServiceStatus, error)

InstalledLoginServiceStatus is read-only. A running service is not a claim that any particular scanout layout is supported; attachment capture reports that independently, without requesting Portal consent or elevation.

func ManageLoginScreenServiceControlled added in v0.23.0

func ManageLoginScreenServiceControlled(ctx context.Context, request LoginServiceDeploymentRequest, report func(LoginServiceDeploymentEvent), control LoginServiceDeploymentControl) (ServiceStatus, error)

Jump to

Keyboard shortcuts

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