CodeVetter · Repo Unpack · Feature catalog
rustdesk/rustdesk
User-facing features map to ConnType variants (default remote desktop, file transfer, view camera, port forward/RDP, terminal) chosen per session, plus host-side services (video, audio, clipboard, input, printer, terminal). Administrative surface is a large CLI (install/service/config/password/deploy) plus TCP/IPC control channels. Monetized/enterprise features hang off the optional api-server (hbbs_http: account, strategy sync, address book, audit upload) and the `--deploy`/`--assign` device-registration commands.
- Outgoing session types are selected in `session_add` by booleans → ConnType: FILE_TRANSFER, VIEW_CAMERA, TERMINAL, PORT_FORWARD, RDP, or DEFAULT_CONN; Flutter passes them from `flutter/lib/main.dart`'s WindowType dispatch (RemoteDesktop, FileTransfer, ViewCamera, PortForward, Terminal).
- Remote desktop video: `src/server/video_service.rs` captures via `scrap::Capturer` per display (VideoSource::Monitor) or camera, encodes VP8/VP9/AV1 (`VpxEncoderConfig`, `AomEncoderConfig`) or hardware encoders behind `hwcodec`/`vram` features, with `VideoQoS` adaptation and DXGI recovery logic on Windows.
- File transfer runs through `base::fs` TransferJob machinery and `ipc::FS` messages (ReadDir/RemoveDir/NewWrite/WriteBlock/CheckDigest/Rename...); `Remote` in io_loop owns `read_jobs`/`write_jobs`/`remove_jobs` lists and `FileManager` is exposed via `file_trait`.
- Clipboard sync uses arboard + clipboard-master with a custom `dyn.com.rustdesk.owner` marker format, `CLIPBOARD_INTERVAL` 333ms polling, multi-clipboard support, and optional `unix-file-copy-paste` feature for file paste; a second `file-clipboard` service is registered when the feature is on.
- Remote input: `libs/enigo` Enigo (keyboard/mouse injection) on the controlled side plus `input_service` services (cursor, pos, window_focus); relative-mouse MOUSE_TYPE_MOVE_RELATIVE=5 is supported by the Flutter client only; Linux Wayland input goes through uinput (`input_service::setup_uinput`, `server/uinput.rs`).
- Remote terminal: `terminal_service` (desktop) with ConPTY via portable-pty on Windows and a separate `--terminal-helper` process (`server/terminal_helper::run_terminal_helper`) because ConPTY is incompatible with CreateProcessAsUserW; Flutter has a full terminal model layer (terminal_model, mouse handler, alt-screen scroll).
- TCP port forwarding and RDP tunneling: `src/port_forward.rs` + `port_forward_mux.rs` (Tunnel/Claim/CHANNEL_WINDOW) forward local ports through the encrypted session; `run_rdp` shells out to cmdkey/mstsc on Windows reading creds from rdp_username/rdp_password env vars.
- Wake-on-LAN and LAN discovery: `wol-rs` dependency plus `lan::start_listening()` answering `PeerDiscovery` ping/pong UDP broadcasts gated by `enable-lan-discovery` option, reporting id/hostname/username/mac.
- Auth features: permanent/temporary passwords, approve modes, ID whitelist (`OPTION_ID_WHITELIST`), IP whitelist (`whitelist`), 2FA TOTP via totp-rs stored encrypted in config (`auth_2fa::generate2fa`/`verify2fa`), trusted devices, and optional server-side strategies synced from the API.
- Privacy mode on Windows/macOS blanks/locks the physical display during a session via pluggable impls under src/privacy_mode/ (win_mag, win_exclude_from_capture, win_virtual_display, win_topmost_window, macos); a separate whiteboard overlay feature lives in src/whiteboard/ (client/server/per-OS backends) launched via the `--whiteboard` CLI flag.
- Virtual display (Windows): `virtual_display_manager` drives either the RustDesk IDD driver (`rustdesk_idd`) or amyuni (`amyuni_idd`), selected by IDD_IMPL const; CLI `--install-idd`/`--uninstall-amyuni-idd` manage the driver.
- Remote printing (Windows, flutter builds): `remote_printer` crate installs/updates a printer (`--install-remote-printer` CLI) and `printer_service` streams jobs; gated on Win10+.
- Self-update: `updater.rs` runs an auto-update thread (first check after 30s, then daily, 30-min retry, skipped while sessions are active via `has_no_active_conns`); platform update paths include Windows `update_me`, macOS `update_from_dmg` with a root-owned flock at /var/run/rustdesk-update.lock.
- Address book / account / audit: `hbbs_http` module talks to the self-hosted API server — `account.rs` (login/OIDC), `sync.rs` (heartbeat every 15s, sysinfo upload, strategy options), `record_upload.rs` (session recording upload), `downloader.rs`; Flutter models (ab_model, user_model, group_model) consume it.
- CLI admin surface includes `--password`, `--set-unlock-pin`, `--get-id`/`--set-id`, `--option` get/set, `--config` (decode server config from renamed exe string), `--import-config`, `--assign` (POST /api/devices/cli with Bearer token), `--deploy` (device deployment with distinct exit codes 1/3/5/6), `--check-hwcodec-config`, `--version`/`--build-date`.