Skip to main content

Module launcher

Module launcher 

Source
Expand description

On-demand binary launcher for MockServer.

Downloads the self-contained, JVM-less MockServer binary bundle for the current platform from a GitHub Release, verifies its SHA-256, caches it per-user, and launches it. No Java installation and no Docker required.

This is a faithful port of the reference implementation in mockserver-node/downloadBinary.js.

§Environment overrides

VariablePurpose
MOCKSERVER_BINARY_BASE_URLMirror host for the release assets (corporate / air-gapped)
MOCKSERVER_BINARY_CACHECache directory (default: per-OS user cache)
MOCKSERVER_SKIP_BINARY_DOWNLOADFail instead of downloading (air-gapped CI with a pre-seeded cache)
HTTPS_PROXY / HTTP_PROXYHonoured by the HTTP client for proxy routing

Structs§

BundleName
The base name and extension of the bundle archive for the given version.
EnsureOptions
Options for ensure_binary.
Platform
Resolved platform triple for the bundle file name.
ServerHandle
A handle to a running MockServer process.

Enums§

LauncherError
Errors specific to the binary launcher.

Constants§

VERSION
The MockServer version this client targets — derived from Cargo.toml at compile time.

Functions§

asset_url
Compute the download URL for a release asset.
bundle_base_name
Compute the bundle base name for a given version on the current platform.
cache_dir
Resolve the binary cache base directory.
ensure_binary
Ensure the platform binary is present and return the launcher path, downloading + verifying + extracting + caching on first use.
ensure_launcher
Ensure the launcher binary is available and return its path.
is_snapshot
Returns true if the version string contains “-SNAPSHOT” (case-insensitive), indicating a pre-release snapshot build.
launcher_path
The expected path to the launcher binary inside the extracted bundle.
prune_old_versions
Remove old version directories from the cache base, keeping only the current version (and at most one previous). Also removes leftover .part and .sha256 temp files. Safe: never deletes outside the cache dir; tolerates concurrent runs.
resolve_platform
Map the current platform and architecture to the bundle naming tokens.
sha256_bytes
Compute the SHA-256 hex digest of a byte slice (used in tests).
sha256_file
Compute the SHA-256 hex digest of a file.
start
Download (if needed) and start a MockServer on the given port.
start_with_version
Start a MockServer of the given version on the given port.

Type Aliases§

LauncherResult
Result type alias for launcher operations.