feat: add automated WireGuard runtime installation for Windows desktop client with bundled MSI installer

Add install-runtime command to tunnel-helper for automated WireGuard installation on Windows. Download and bundle official WireGuard MSI during build process with automatic version discovery from wireguard.com.

Add ensure_windows_runtime_installed checks before connect/disconnect operations. Implement install_windows_runtime with UAC elevation prompt and install_windows_runtime_direct for MS
This commit is contained in:
2026-03-24 18:35:19 +01:00
parent 3f7e830761
commit 5003a2f0f7
4 changed files with 144 additions and 1 deletions

View File

@@ -78,6 +78,28 @@ else
fi
install -m 755 "${HELPER_DIR}/target/${TARGET}/release/${OUTPUT_NAME}" "${OUTPUT_DIR}/${OUTPUT_NAME}"
if [ "${TARGET}" = "x86_64-pc-windows-msvc" ]; then
if ! command -v curl >/dev/null 2>&1; then
echo "curl is required to bundle the official WireGuard Windows MSI."
exit 1
fi
MSI_URL="${NEXAVPN_WIREGUARD_WINDOWS_MSI_URL:-}"
if [ -z "${MSI_URL}" ]; then
INDEX_HTML="$(curl -fsSL https://download.wireguard.com/windows-client/)"
MSI_NAME="$(printf '%s' "${INDEX_HTML}" | grep -oE 'wireguard-amd64-[0-9.]+\.msi' | sort -uV | tail -n 1)"
if [ -z "${MSI_NAME}" ]; then
echo "Unable to discover the latest official WireGuard Windows MSI."
exit 1
fi
MSI_URL="https://download.wireguard.com/windows-client/${MSI_NAME}"
fi
echo "Bundling WireGuard Windows runtime from ${MSI_URL}"
rm -f "${OUTPUT_DIR}/wireguard-installer.msi"
curl -fsSL "${MSI_URL}" -o "${OUTPUT_DIR}/wireguard-installer.msi"
fi
if [ "${TARGET}" = "aarch64-apple-darwin" ]; then
WG_BIN="$(command -v wg || true)"
WG_QUICK_BIN="$(command -v wg-quick || true)"