Desktop client application of NymVPN.
- Rust
- Nodejs, latest LTS version recommended
- npm
Some system libraries are required depending on the host platform. Follow the instructions for your specific OS here
npm i
Tauri CLI (tauri-cli
) is provided as a local project package. To
run tauri commands you can use
npm run tauri help
If you want to run tauri through cargo you can install it on your
system, then you can run tauri commands via cargo
cargo install tauri-cli
cargo tauri help
The app looks for the config file config.toml
under nym-vpn
directory, full path is platform specific:
- Linux:
$XDG_CONFIG_HOME/nym-vpn/
or$HOME/.config/nym-vpn/
- macOS:
$HOME/Library/Application Support/nym-vpn/
- Windows:
C:\Users\<USER>\AppData\Roaming\nym-vpn\
For example on Linux the full path would be
~/.config/nym-vpn/config.toml
.
NOTE All properties are optional
# absolute path to a network configuration file
env_config_file = "/home/<USER>/.config/nym-vpn/sandbox.env"
# 2-letter country code for the default entry and exit node location
default_entry_node_location_code = "FR"
default_exit_node_location_code = "DE"
env_config_file
is the absolute path to a network configuration
file, pick the relevant one
here.
NOTE The sandbox config will be used by default if no config is provided.
From the repo root run
./wireguard/build-wireguard-go.sh
Then you need to provide the lib path to the rust library search
path. Create the file .cargo/config.toml
from repo root
[build]
rustflags = ['-L', '/<ABSOLUTE_PATH_TO>/nym-vpn-client/build/lib/<PLATFORM_ARCH>']
or provide the env variable in each commands
RUSTFLAGS="-L /<ABSOLUTE_PATH_TO>/nym-vpn-client/build/lib/<PLATFORM_ARCH>" npm run dev:app
Replace <ABSOLUTE_PATH_TO>
accordingly.
Replace <PLATFORM_ARCH>
by your host specific platform and arch:
- Linux:
x86_64-unknown-linux-gnu
- Mac x86_64:
x86_64-apple-darwin
- Mac M1/M2/M3:
aarch64-apple-darwin
- Windows:
x86_64-pc-windows-msvc
To start the app in dev mode run:
npm run dev:app
or via cargo
cd src-tauri
cargo tauri dev
NOTE Starting a VPN connection requires root privileges as it
will set up a link interface.
If you want to connect during development, you need to run the app
as root, likely using sudo
(or equivalent)
sudo -E RUST_LOG=debug cargo tauri dev
Rust logging (standard output) is controlled by the RUST_LOG
env variable
Example:
RUST_LOG=nym_vpn_desktop=trace,nym_client_core=warn,nym_vpn_lib=info npm run dev:app
or
cd src-tauri
RUST_LOG=trace cargo tauri dev
While developing, you might want to disable the splash-screen
to speedup app loading time.
Either set the APP_NOSPLASH
env variable to true
or pass the
--nosplash
flag to the app
npm run dev:app -- -- -- --nosplash
For convenience and better development experience, we can run the app directly in the browser
npm run dev:browser
Then press o
to open the app in the browser.
Browser mode requires all tauri commands (IPC calls) to be mocked.
When creating new tauri command, be sure to add the corresponding
mock definition into src/dev/tauri-cmd-mocks/
and update
src/dev/setup.ts
accordingly.
We are using clap to handle CLI for the app.
In dev mode, you can pass CLI arguments and flags with the --
separator
npm run dev:app -- -- -- --help
# or
cargo tauri dev -- -- --help
ts-rs can be used to generate TS type definitions from Rust types
To generate bindings, first annotate Rust types, then run
cd src-tauri
cargo test
Generated TS types will be located in src-tauri/bindings/
First build wireguard-go
lib and set RUSTFLAGS
accordingly,
see here
Then run the following commands
cd nym-vpn-desktop
npm i
mkdir dist
TAURI_PRIVATE_KEY=1234 TAURI_KEY_PASSWORD=1234 npm run tauri build