Volt Download Manager
  1. Home
  2. Help
  3. Architecture

Architecture

How Volt Download Manager's pieces fit together.

Crates

Path Crate Role
crates/engine vdm-engine Downloads one file over HTTP(S) or FTP(S): probe, segment planner, connection workers, resume state, per-host limits, speed limiter, checksums, proxy scripts
crates/app vdm-app The desktop app (voltdownloadmanager.exe, egui): list, categories, queues, scheduler, dialogs, tray, settings
crates/cli vdm-cli Headless downloads with progress (get, resume), videos, torrents and the automation API's commands: a library the app's program runs (voltdownloadmanager --cli …), and voltdownloadmanager-cli, a small launcher that starts it with the same arguments, terminal and exit code
crates/mcp vdm-mcp The MCP server (voltdownloadmanager-mcp): AI assistants list, add and control the running app's downloads through the automation API
crates/remote vdm-remote The remote control (#141): the HTTPS server a paired phone or computer on the local network uses (its page, pairing codes, device tokens, the self-signed certificate); every request becomes an automation API command the app answers
crates/nmhost vdm-nmhost The browser's native messaging host: takes captured downloads from the extension and hands them to the app
crates/ipc vdm-ipc The single-instance channel (a token-protected local socket), the data folder, the capture rules shared by the app and the host, and the site rules (#1778: a User-Agent, headers, connections, the browser-like connection and, #1960, a proxy by site pattern) shared by the app and the command line
crates/debrid vdm-debrid Debrid accounts (#44): the services' official APIs (Real-Debrid, AllDebrid, Premiumize, TorBox, Mega-Debrid) turn a file host's link into a direct one the engine downloads
crates/cnl vdm-cnl Click'n'Load 2 (#37): the listener on 127.0.0.1:9666 that reads a link site's posts into packages for Link grabber, with limits on what it takes
crates/extract vdm-extract Archive extraction (#37): zip, tar, gz and xz in process; 7z and RAR through an installed 7-Zip, run as its own program; in place through HatchZip when asked. Archive tests (check.rs, #1661): 7z t, a ZIP in process without it, and a ZIP's damaged entries placed in the file
crates/geo vdm-geo Where a download's server is (#140): an IP-to-country range table built from DB-IP's Lite data (tools/geo/build.py), looked up on this computer only, and the countries' flags
crates/tools vdm-tools Video pages through yt-dlp and ffmpeg, image galleries through gallery-dl (run as separate programs); while a network adapter is chosen, their connections go through a proxy of VDM's on 127.0.0.1 that binds them to it (relay.rs); each runs in a folder it can write, also its TEMP (workdir.rs)
crates/crash vdm-crash Crash and freeze reports: the monitor process, out-of-process minidumps, symbolicated stacks, the report's text and the release logs (crash-reports.md)
crates/torrent vdm-torrent BitTorrent and magnet links through librqbit
crates/labserver vdm-labserver An HTTP Range server with a request log and fault injection, and an FTP/FTPS server with its own faults, for tests and benchmarks
extension/ — The Chromium (MV3) and Firefox extension
docs/ — The user guide and tutorials, this file, the benchmark data; the website makes the guide its help pages, which Help opens
website/ — vdm.mikaillab.com's own pages (home, download, features, themes, FAQ); tools/website/build.py adds the help from docs/ and the news from the CHANGELOG, in 22 languages, and GitHub Pages publishes it

Dependencies point inward: app, cli, mcp, nmhost and remote use engine and ipc; the engine knows nothing of the UI. The app sees the engine only through its events (progress, segment table snapshots, finished, failed).

Engine

Download
 ├─ probe()              size, resumable?, validators (ETag / Last-Modified), file name
 ├─ Planner (pure)       segment table: when a connection is free, the largest remaining
 │                       part is split in half (planner.rs, tested by random simulation)
 ├─ Worker × N           one HTTP/1.1 connection each, reused across segments; slow ones
 │                       are dropped and their part re-split
 │    └─ writes at its offset into <name>.vdm.part (created sparse)
 ├─ HostLimits           learns how many connections each server accepts
 ├─ Limiter (shared)     per-download and global token buckets
 ├─ State                segment table saved atomically (craft-atomic) for crash-safe resume
 └─ events → channel     Progress, Done, Failed

When every segment is done, the part file is checked against the expected size and renamed into place; the file's date can follow the server's.

An answer with no size and no ranges goes on one connection, written in order (single_stream), and may never end (an internet radio, a camera feed: Snapshot::endless). Download::keep ends it where it is, and what arrived is finished as if the server had ended it there (#1780); only the progress window's Stop and keep calls it (App::keep_by_hand, Job::keep). Every other stop cancels it, as any download a server can't resume.

A finished file whose archive test found damage it could place (a ZIP's entries, #1661: the app's archtest.rs) is made a part file again (repair.rs): its last resume state, handed back by a download asked to keep it (Options::keep_state, Snapshot::kept), is written back with only the damaged ranges left to fetch, each starting a few bytes early for the overlap check, and the file renamed to its part file. Resuming it is an ordinary resume: If-Range with the same validators, the overlap check, the digest; a file that changed on the server fails as FileChanged.

A download's first request (get) follows redirects and the pages that lead on to a file by themselves (a waiting page's refresh). Sites whose links aren't the file's address have a module in sites/ (Google Drive: sites/gdrive.rs, its shared folders' pages read there and listed by hub.rs; MediaFire: sites/mediafire.rs; Rapidgator: sites/rapidgator.rs; LuluStream: sites/lulustream.rs): it turns the link into the file's address, reads the site's own pages (a confirmation form, a download button, an error page), names its refusals (Error::Refused) and, where the file's addresses expire, the page that gives a fresh one (sites::origin, asked again when a connection meets an expired address, at most once per expiry and never again at once for an address it then refused; Rapidgator's page is the browser's tab the download came from, Options::page), with pure functions tested without a network. A page whose file comes only once its form is sent back (LuluStream's quality page) says so with PageSays::Form: get posts that form's fields (application/x-www-form-urlencoded) with its next request only and reads the answer as a page; a site that answers with its form again is posted again after a short, growing pause (FORM_REPOST_PAUSE), up to MAX_FORM_POSTS, and then refuses in the site's name (sites::form_refused). The lab server plays such a site on its real host names for the end-to-end tests (labserver/src/drive.rs, labserver/src/mediafire.rs, labserver/src/rapidgator.rs, labserver/src/lulustream.rs).

FTP and FTPS (ftp.rs) go through the same planner, workers and state: a segment is REST + RETR on a control session instead of a ranged GET, SIZE and MDTM stand in for the headers, and sessions are pooled per download and reused between segments.

A folder given to Link grabber (#1774, folder.rs) is read with its subfolders, breadth first: an FTP folder by MLSD, else LIST (ftp::Lister, one session for every folder), a web server's listing page ("Index of", recognized by its title) as page_links reads a page. An entry is a name in the folder, matched by name: a link elsewhere (another host, the folder above, a query, a deeper path) or a name that isn't plain is no entry, and FTP's symbolic links aren't followed. The depth asked (at most MAX_DEPTH), MAX_FOLDERS, MAX_FILES and each listing's size bound it. The app makes each folder's files a package whose folder is the tree's under the download folder (grabber.rs); the lab server serves made-up trees, a hostile one and a huge one (labserver/src/tree.rs) over HTTP and FTP for the end-to-end tests.

A Hugging Face model or dataset (or a folder of one, at a revision) and a GitHub release or tag given to Link grabber (#1772, hub.rs) are listed through the sites' public APIs: the revision is first made its commit, then the tree is read page by page (Link: rel="next", the same API's only), each entry's path taken only when it is a relative path of plain names inside the folder asked (hub::relative_path: no .., absolute path, drive or device name), matched by its names; a file's address is built from the repository, the commit and those names, never taken from the answer. Each file keeps its size and the SHA-256 the site publishes (an LFS file's, a release asset's digest), which becomes the download's checksum. The app makes one package whose folder is the address's path under the download folder, each file in its own folders inside it (Imported::within), unticked; Sites Logins' password for huggingface.co goes as an access token (Authorization: Bearer) to Hugging Face's own hosts only. The lab server plays both APIs (labserver/src/hub.rs): pages, a gated repository, hostile paths, a wrong digest and rate limits.

Files inside a ZIP on a server (#1775, remotezip.rs) are read from its table of contents, at its end: Download File Info's one look (look: the last TAIL bytes, which tell whether the server sends parts, and hold the table of most archives) enables Preview, and Zip preview (zippreview.rs) lists the table (list: the ZIP64 record and the table asked for where they aren't in the end). The parsers are pure functions over bytes, fuzzed (fuzz/fuzz_targets/zip_directory.rs): the table at most MAX_DIRECTORY bytes and MAX_ENTRIES entries, each name at most MAX_NAME, ZIP64's fields read within their extra field, every entry's data before the table and apart from every other's (overlapping entries refuse the archive), names that aren't plain relative paths left out. The files picked are one download (Item::zip, Job::Zip): Fetch asks for the table again, then each file's local header and data in one range request (If-Range with the archive's validator), unpacks stored and Deflate data, counts it and checks its CRC-32 against the table's, and hands the bytes to the extraction's writer (vdm_extract::put_file: the same path checks and staging folder as every extracted entry). The lab server serves made-up ZIPs (labserver/src/zip.rs): ZIP64, a hostile one, overlapping entries, a table too large, and any of them without ranges.

App

One egui window painted to fixed pixel coordinates, plus one immediate viewport per dialog. app.rs holds the state (downloads, queues, settings, the list's selection) and turns menu, toolbar, key and IPC commands into actions. Each dialog is its own module and returns an Outcome (open, closed, done with a value). Windows-only calls are confined to win32.rs and their Linux and macOS counterparts to unix.rs (starting with the session, the browsers' host, sounds, show in folder, the crash handler); every other file is safe, portable Rust. Fonts come from the system: Windows' Fonts folder, macOS's system fonts, fontconfig on Linux (theme.rs). The interface language's script fonts load at start; text in another script gets its font the first time it shows: from VDM's lists of the system's fonts for each script (the first file there that has the letter; on Windows one Han list in the interface language's order, theme::han_files, for the fonts loaded at start, those found later and DirectWrite's alike), then, on Windows and macOS, from the system's own fallback (DirectWrite's, CoreText's, through fontique: egui_system_font_provider) for what the lists don't name; Linux asks fontconfig for any letter. On Windows, Latin, Greek, Cyrillic and single-codepoint CJK text is drawn by DirectWrite (win32.rs, through egui's glyph rasterizer hook): View → Text → Smooth in its natural mode, anti-aliased at the size asked for and placed at quarter pixels with the font's own advances; Classic (the default) in GDI-classic mode, so each letter's hinted shape and whole-pixel width come together. CJK uses the interface language's system face; combining marks, multi-codepoint clusters and missing glyphs stay with egui, as do other scripts.

Themes

Every colour and size a control is drawn with comes from the active theme (#45). A theme is a light and a dark palette, metrics, control styles and an icon style (palette.rs):

  • Palette roles. palette.rs declares each role with a stable key ("button.hot", "list.row", "caption"…), a description and the classic look's light and dark values, written out (the classic look isn't derived). The shared painters (winui.rs, chrome.rs, list.rs, scrollbar.rs) read them through theme::colors() and theme::metrics() and decide each control's states from them; no painting code holds a colour of its own.
  • Derived palettes. derive.rs makes a whole palette from a few seeds (background, surface, text, accent…), mixing every other role in OKLab and keeping WCAG contrast (4.5:1 for text, 3:1 for edges); High contrast strengthens every edge on top. native.rs seeds the Native theme from the system's accent and contrast (Windows' settings, the freedesktop portal on Linux, macOS's accent).
  • Control styles. palette::Controls names each control's shape (text boxes, check boxes, buttons, progress bars, scroll bars, the focus mark, the title bar); the style themes (Metro, Adwaita, Breeze, Luna, Aero, Aqua, Emerald) pick theirs, and on Windows VDM then draws the title bar itself (the caption.* roles).
  • Theme files. themefile.rs reads TOML or JSON from the data folder's themes (one file, or <id>/theme.toml with icons beside it). A file names only what it changes; the rest comes from the theme it inherits (a built-in's id or another file, the classic look by default), down a chain in which a cycle is refused. Unknown keys are warnings, not errors. The built-in style themes are such files too, carried in the program (crates/app/assets/themes).
  • Icon sets. themeicons.rs draws a theme's icons (named by what they're for: tb-add-url, cat-music…, SVG or PNG at 16, 24, 32 and 48 px, -symbolic ones inked in the text colour) where the classic look draws its own; a need the set lacks keeps the classic icon.

Where a window puts its controls stays its layout. So do the icons before file names (fileicons.rs): the Windows shell's system image lists, macOS Finder's (NSWorkspace), the Linux desktop's icon theme (xdgicons.rs, shared-mime-info and the Icon Theme Specification). Each type is looked up once per pixel size, on a background thread. Tango's icons (bundled) stand in until the system's icon is ready, and wherever the system has none.

Drawing

The windows are drawn with OpenGL (eframe's glow) or with the system's own graphics API through eframe's wgpu, with that one backend only: Direct3D 12 on Windows (the default there), Vulkan on Linux, Metal on macOS (choices there; OpenGL stays their default until real graphics cards have tried them, #206). View → Draw with picks one, from the next start. One code path does it on every system (crates/app/src/renderer.rs): when the chosen one can't start, the other one is tried, so the windows always open. A watched start with the system's API leaves a marker until its first frame is drawn: a start that ends before it (a crash inside the driver), one whose first frame doesn't come within 10 seconds (VDM then starts again with OpenGL), or a graphics card lost twice in 10 minutes is remembered with its reason, which the menu shows. A way that can't start within 10 minutes of a lost card isn't remembered: its driver may still be resetting (#1974: Direct3D 12 then finds only WARP), so the next start tries it again. With OpenGL, a window eframe can't paint (its context can't be made current on it, its frame can't be shown) is skipped and painted again 100 ms later; one whose paints keep failing for seconds is a lost device too (VDM starts again; twice in 10 minutes, OpenGL is remembered as failing on Windows). wgpu-core unwraps some of the driver's results instead of calling the device-lost callback (#2128: PendingWrites::activate on Direct3D 12's DXGI_ERROR_DEVICE_REMOVED): the panic hook (crash.rs) hands such a panic, from wgpu's own code, to the same loss handling (renderer::lost_panic), so it starts VDM again rather than end it with a report. On Windows, a freeze or a crash whose report shows the window's or the crashed thread inside OpenGL's driver is remembered too, by the crash report's window (crashui.rs), from the stack's modules (#847, #1659). The fork's eframe tells VDM through its viewport hooks (gl_paint_failed, #1448).

View → Interface size (scale.rs, #262) is egui's zoom factor over the display's own scale: every window is laid out in points, so it opens that much larger; one larger than the screen scrolls.

View → Font (theme.rs, #1489) is separate: the font file the interface's text is drawn in (interface_font in settings.json; Segoe UI, the system's own, unless chosen) and interface_text_size, the percent of the theme's sizes the text is drawn at. theme::font_size is the one place the sizes come from, for egui's text styles and for the custom-drawn Win32 controls alike (winui::tahoma); the layout's own measurements don't change, so text can overflow where a window is tight, but nothing moves. On Windows the DirectWrite rasterizer (win32::classic_text) draws the chosen file too, and the glyph atlas is rebuilt when the font changes.

Data

The download list and settings are saved atomically to the data folder (downloads.json): %APPDATA%\voltdownloadmanager\ on Windows, ~/.local/share/voltdownloadmanager on Linux, ~/Library/Application Support/voltdownloadmanager on macOS, a data folder beside a portable copy, or VDM_DATA_DIR (vdm_ipc::data_dir). The browser host reads the same file for the capture rules, so a change in Options applies to the next captured download.

Sign-in secrets (debrid accounts, Sites Logins' and the proxy's passwords) live in the system's keychain (secrets.rs, #44): Windows Credential Manager (win32.rs), the Secret Service on Linux or the macOS keychain (unix.rs). The settings keep a keychain:<service>/<scope>/<key> reference in their place, written only once the keychain has confirmed the secret; without a keychain (or with a locked one, never unlocked for VDM) the secret stays in the settings as before.

A download's server location (#140) is the country of the address it connected to, looked up in vdm-geo's table on this computer (countries.rs names it in the interface language); the release job builds the table again from the month's data (tools/geo/build.py --release).

Browser integration

page ──► extension ──native messaging──► vdm-nmhost ──ipc──► app

The extension asks the host which file types to take, checks each download against them, and cancels the browser's download only after the app has accepted it; otherwise the browser keeps it, and the extension says why.

A message to the host is at most 1 MB (vdm_ipc::MAX_MESSAGE; the host refuses more, and the browser lets a host answer no more than that either). A page's links past it go in parts, each measured as the widest browser writes it (wireSize in background.js) and carrying the page's referrer and cookies and its place (vdm_ipc::LinksPart); the host hands each over as it comes, and the app keeps them (linkparts.rs) until the last is in, then opens Link grabber with the whole list.

The toolbar button's popup lists VDM's newest downloads (#1496). While it is open, background.js keeps one native port to the host (connectNative: one helper process, not one per question) and asks every second {"recent": …}; the host asks the running app (vdm_ipc::RecentAsk), which answers with vdm_ipc::api::RecentAnswer: the newest downloads that match the search and the filter, the counts of each filter, and the system's icons for the file types the popup lacks (fileicons.rs, PNG data: addresses, each type once per size), the whole within 512 KB. The popup's buttons send {"downloadAct": …} (vdm_ipc::RecentAct): the app opens the file or its folder, puts the file on the clipboard or opens the share sheet (fileclip.rs, each system's own calls in win32.rs and unix.rs). Neither question starts the app. The toolbar button's count of running downloads comes from the same answers, watched while any runs. With downloads sent to another VDM, the list is its remote control's (api/list), cut to the same view in background.js.

The host serves only VDM's own extension. Its IDs are in one place, vdm_ipc::extension (crates/ipc/src/extension.rs): the unpacked copy's (UNPACKED_ID, from the manifest's public key), the Chrome Web Store's (STORE_ID, signed with the store's own key: pack.ps1 leaves the manifest's key out of the store's copy), the Firefox add-on's (FIREFOX_ID) and its addons.mozilla.org page; the Edge and Opera stores' are placeholders, never served, until the extension is listed there. The host writes each browser's manifest with those IDs, and the app offers the store's copy (Add to Chrome, Add to Firefox) before the unpacked one.

Remote control

phone ──HTTPS (paired token)──► vdm-remote ──ipc::Sink──► app (answer, remote_add)

--headless (headless.rs, #157) runs the same App without eframe: a loop calls its tick (what logic runs at every frame) on a bare egui::Context, woken by the command channel, and never its ui; commands are added as the remote control adds them (no window). The Dockerfile and docker/ (Compose, Unraid's template) run it on a server (server.md).

The server runs on the app's Tokio runtime, one listener per local network address. Each request is checked (Host, Origin, token), turned into an vdm_ipc::Command marked remote (a field no request line can set) and handed to the app through the same channel as the command line's; the app answers it on its next frame, as it answers the automation API. Its page is built in (crates/remote/web) and its texts come from the app's catalogs (remote.rs).

Translations

Every text the UI shows goes through crate::i18n (craft-i18n catalogs, i18n/<locale>.tsv). tools/i18n/extract.py rebuilds i18n/en.tsv from the source, with a note for translators on each text (what it is, where it shows, its placeholders). tools/i18n/translate.py fills what the other catalogs lack (rows marked #, machine), following each language's style guide (i18n/style/) and the glossary; a row a person reviewed is never replaced, and CI (reviewed_guard.py) fails a change that drops one. The website has its own catalogs (i18n/site/, tools/website/translate_site.py).

Pictures

The help pages' pictures (docs/images/help/) come from one list, tools/shots/shots.toml: tools/shots/make.py opens each window through VDM's own /show <window> command line in a test instance off the screen, crops and annotates it from the window's accessibility tree, and writes lossless WebP; make.py check (CI) keeps the list, the pages and the files in step. The published ones are taken on GitHub's Windows runner (docs-shots.yml).

Contributors

tools/contributors.py reads who opened pull requests and issues, and who commented, from GitHub's public API (the maintainer, Claude and bots left out) for every place that thanks them: the website's home page, /contributors.html and each release on the News page (build.py, on every build), each release's notes (release.yml, the people active since the release before) and the README (python tools/contributors.py readme at each release's preparation: its round photos are committed in art/contributors/, since GitHub can't round a picture in a README).

Tests and benchmarks

cargo test runs unit tests and end-to-end downloads against vdm-labserver with injected faults (slow, dropped and refused connections, servers without ranges, changing files). tools/bench runs the published speed comparison; its raw data is in docs/bench/.

Free, open source, no ads, no trial.

Download Volt Download Manager