39 lines
1.4 KiB
Markdown
39 lines
1.4 KiB
Markdown
# Windows Deployment Guide (.exe)
|
|
|
|
To ensure the client is a lightweight `.exe` that consumes less than 256MB of RAM, follow these build instructions.
|
|
|
|
## 🛠 Build Process
|
|
|
|
1. **Environment Setup**:
|
|
- Install [Rust](https://rustup.rs/).
|
|
- Install [LLVM](https://llvm.org/build/) (required for some networking crates).
|
|
|
|
2. **Optimization Flags**:
|
|
To keep the binary small and memory usage low, use the following `Cargo.toml` profile:
|
|
```toml
|
|
[profile.release]
|
|
opt-level = 'z' # Optimize for size
|
|
lto = true # Link Time Optimization
|
|
codegen-units = 1 # Maximize optimization
|
|
panic = 'abort' # Remove stack unwinding (saves space/RAM)
|
|
strip = true # Remove symbols from the binary
|
|
```
|
|
|
|
3. **Building the .exe**:
|
|
```bash
|
|
cargo build --release
|
|
```
|
|
The resulting executable will be in `target/release/meshvpn-client.exe`.
|
|
|
|
## 📦 Resource Constraints (< 256MB RAM)
|
|
To guarantee low memory usage:
|
|
- **Asynchronous Runtime**: Using `tokio` with the `current_thread` scheduler instead of `multi_thread` to reduce thread overhead.
|
|
- **Zero-Copy**: Using `bytes` crate for packet handling to avoid unnecessary memory allocations.
|
|
- **No GUI**: By keeping it a CLI tool, we avoid the massive overhead of Electron or similar frameworks.
|
|
|
|
## 🚦 Administrator Requirements
|
|
The `.exe` must be run as **Administrator** to:
|
|
1. Load the `wintun.dll`.
|
|
2. Create the virtual network adapter.
|
|
3. Set routing table entries.
|