VilaNet CLI
Official VilaVPN client

The headless VilaVPN client
in a single binary.

vilanet-cli is the scriptable command-line sibling of the VilaNet app — log in, pick a node, and bring up a TUN or SOCKS5 tunnel on Linux, macOS, or Windows. Built on embedded sing-box. Designed for servers, CI, and power users.

~12 MB
Static binary
3
Platforms
11
CLI commands
What is VilaNet CLI

A single static binary. Six jobs.

VilaNet CLI ships as one ~12 MB executable that authenticates against your VilaNet account, fetches your nodes, brings up a TUN or SOCKS5+HTTP tunnel via embedded sing-box, and stays alive as a foreground process or a background daemon. It is the official headless companion to the VilaVPN app — same auth, same nodes, same protocols, zero GUI.

OS-keychain credentials

Passwords are never written to disk in plaintext — they go straight into the macOS Keychain, Windows Credential Manager, or libsecret on Linux.

Embedded sing-box

Hysteria2, VLESS-Reality, Trojan, VMess, AnyTLS, Shadowsocks-2022 — all the protocols the app supports, in one binary.

Script-friendly output

Every command takes --json. Exit codes are stable across releases. Drop it into shell scripts, GitHub Actions, or systemd without parsing prose.

TUN or SOCKS5

Full-system TUN capture for desktops, or --no-tun --mixed 0.0.0.0:1080 for bastion hosts and Docker containers. No kernel module required for SOCKS mode.

Hot node switching

Swap to a different node mid-session with vilanet-cli switch --node ID — credentials stay cached and traffic resumes in 1–2 seconds.

Atomic, durable settings

Every config change writes the settings file atomically with 0600 permissions, so a crash or concurrent write never leaves you with a half-written file.

Installation

Pick your platform

Pre-built binaries for the latest release are published on the GitHub releases page. Grab the CLI tarball for your OS, then follow the steps below. Each flow finishes in under a minute.

macOS — Apple Silicon & Intel

Download the matching tarball from the GitHub releases page, install to /usr/local/bin, and you're done. TUN mode requires sudo the first time; SOCKS-only mode does not.

# 1. Grab the tarball for your platform from https://github.com/vilavpn/vilanet-cli/releases # Apple Silicon (M1/M2/M3/M4) → vilanet-cli_darwin_arm64.tar.gz # Intel → vilanet-cli_darwin_amd64.tar.gz # 2. From the directory where you saved it: $ tar -xzf vilanet-cli_darwin_*.tar.gz $ sudo install -m 0755 vilanet-cli /usr/local/bin/ $ vilanet-cli version # sanity check
Auto-start at login (SOCKS-only): A LaunchAgent template ships under packaging/launchd/. TUN cannot run as a user-level agent on macOS — use SOCKS5 mode for unattended operation.
$ sudo bash scripts/install-macos.sh --agent $ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.viraltech.vilanet.cli.plist

Linux — amd64 / arm64 / armv7

Download the matching tarball (amd64, arm64, or armv7) from the GitHub releases page, install it, and grant network capabilities so it doesn't need to run as root. For SOCKS-only operation, skip the setcap step.

# 1. Grab the tarball for your platform from https://github.com/vilavpn/vilanet-cli/releases # vilanet-cli_linux_amd64.tar.gz / _arm64.tar.gz / _armv7.tar.gz # 2. From the directory where you saved it: $ tar -xzf vilanet-cli_linux_*.tar.gz $ sudo install -m 0755 vilanet-cli /usr/local/bin/ $ sudo setcap 'cap_net_admin,cap_net_bind_service+eip' /usr/local/bin/vilanet-cli $ vilanet-cli version
systemd service: A templated unit ships under packaging/systemd/ and runs as your user with the right environment for headless operation.
$ sudo install -m 0644 packaging/systemd/[email protected] /etc/systemd/system/ $ sudo systemctl daemon-reload $ sudo systemctl enable --now vilanet-cli@$USER $ journalctl -u vilanet-cli@$USER -f

Windows 10 / 11

Download vilanet-cli_windows_amd64.zip from the GitHub releases page, extract vilanet-cli.exe, and either run it interactively in elevated PowerShell or install it as a Windows Service. Background daemon mode (--background) is not supported on Windows — use the Service.

# 1. Grab the Windows ZIP from https://github.com/vilavpn/vilanet-cli/releases # 2. Extract vilanet-cli.exe, then in elevated PowerShell: PS> .\vilanet-cli.exe version PS> .\vilanet-cli.exe login PS> .\vilanet-cli.exe connect
Windows Service (recommended): Runs under LocalSystem, which has the TUN privileges Windows requires. Survives reboots.
PS> New-Item -Type Directory "$Env:ProgramFiles\VilaNet" PS> Copy-Item vilanet-cli.exe "$Env:ProgramFiles\VilaNet\vilanet-cli.exe" PS> .\packaging\windows\install-service.ps1 PS> Start-Service VilaNetCLI
Quick Start

Your first connection, in four steps

Once the binary is on your PATH, these four commands take you from a clean machine to a working tunnel. Replace the country code and node ID with the ones that fit you best.

1. Authenticate

Log in once. Credentials land in the OS keychain — never in a plaintext file unless you ask for it with --insecure-store.

$ vilanet-cli login

2. Browse your nodes

List packages and servers. The IDs are stable hex digests — safe to put in scripts.

$ vilanet-cli list packages $ vilanet-cli list servers --country HK

3. Connect

Pick a country, a specific node, or let auto-select do the work. Foreground by default, --background for daemon mode on Unix.

$ sudo vilanet-cli connect --country HK

4. Verify & tear down

In another shell, ask the daemon how it's doing. Hit Ctrl-C in the original terminal — or disconnect the background daemon.

$ vilanet-cli status --stats $ vilanet-cli disconnect
happy-path.sh
$ vilanet-cli login Email: [email protected] Password: ******** ✓ logged in as [email protected] $ vilanet-cli list servers --country HK PACKAGE ID NAME COUNTRY TYPE gold-hk-2026 a1b2c3d4e5f60718 HK-Edge-01 HK hy2 gold-hk-2026 f0e1d2c3b4a59687 HK-Edge-02 HK vless gold-hk-2026 9876543210fedcba HK-Edge-Pro HK hy2 $ sudo vilanet-cli connect --country HK selecting node: HK / auto … spinning up the tunnel … tunnel up — package="gold-hk-2026" server="HK-Edge-01" [vpn] state=running Press Ctrl-C to disconnect.
How traffic flows

From your shell to the open internet

The CLI handles authentication and node selection in Go, hands a generated config to the embedded sing-box, then captures traffic either via TUN or via a local SOCKS5+HTTP listener.

Your shell vilanet-cli connect macOS / Linux / Windows sing-box TUN inbound SOCKS5 + HTTP Clash API :9090 DNS-over-HTTPS VilaNet exit node Hysteria2 / VLESS-Reality high-throughput · resilient Internet 🌐
Command reference

Every subcommand, at a glance

All commands accept the global flags --json, --debug, --insecure-store, and --config DIR. Click any card to copy the example invocation.

login

Authenticate and persist credentials to the OS keychain. Interactive prompts by default.

--email--password--json
logout

Clear stored credentials and ephemeral caches. Idempotent.

--purge
list packages

Print every package on your account — name, node count, system type, due date.

--json
list servers

Print server nodes with optional country / package filters. IDs are stable hex digests.

-p / --package--country
connect

Bring up the VPN tunnel. Foreground by default; --background for daemon mode (Unix).

-n / --node-c / --country--auto--no-tun--mixed--background
disconnect

Stop the background daemon via IPC. Idempotent — exits 0 when no daemon is running.

status

Print the daemon's live state: PID, node, uptime, traffic counters.

--stats--json
switch

Swap the running daemon to a different node without losing credentials. ~1–2 s packet-loss window.

--node
settings get / set / list

Read or write any of 27 configuration keys — routing mode, DNS leak blocks, mux/sniff toggles, HY2 tuning, more. Atomic writes; values persist to config.json.

KEY [VALUE]--json
logs

Print recent lines from the rolling daily log file, with optional tail -f mode.

-f / --follow--lines
diag

Write a redacted support-bundle .tar.gz (logs, settings, environment) under ${StateDir}/diag/. Mode 0600. Safe to email to support.

-o / --output
version

Print version, Go runtime, and platform — useful in bug reports. Also reachable as --version.

help

Show the built-in help text for any command. Try vilanet-cli help connect.

Try it now

Interactive terminal simulator

Type any vilanet-cli command below and see the (simulated) output. Or click a quick action to drop in a ready-made example. No binary required — this all runs in your browser.

vilanet-cli --help vilanet-cli version vilanet-cli login vilanet-cli list packages vilanet-cli list servers --country HK vilanet-cli connect --country HK vilanet-cli status --stats vilanet-cli disconnect vilanet-cli settings list vilanet-cli settings set network.block_stun true vilanet-cli logs --lines 5 vilanet-cli diag vilanet-cli logout --json clear
vilanet-cli — simulator
$
Note: the simulator reproduces the look of real CLI output but does not connect to anything — it can't reveal your account info or actually establish a tunnel.
Configuration

A single, atomic config.json

Settings live in one JSON file, written atomically with mode 0o600. Read or change anything with vilanet-cli settings get / set — flag overrides on connect always win over the file.

Where it lives

OS Path
Linux~/.config/vilanet/config.json
macOS~/Library/Application Support/com.viraltech.vilanet/config.json
Windows%APPDATA%\VilaNet\config.json

Override with vilanet-cli --config /path/to/dir connect. Accepts a directory or a path ending in .json.

Notable keys

Key Default
tun.stackmixed
tun.mtu9000
tun.ipv6false
mixed.port10081
routing_moderule · global · direct
network.dns_modefakeip · real
network.sniff_enabledtrue
network.mux_enabledfalse
network.block_stundefault · true · false
network.block_dotdefault · true · false
network.block_quicdefault · true · false
block_pornfalse
hy2.speed_modeoff
hop_interval10
clash_api.port9090

Example: tune for a 200 Mbps line

$ vilanet-cli settings set hy2.speed_mode custom $ vilanet-cli settings set hy2.custom_mbps 200 $ vilanet-cli settings set tun.stack system # better throughput on Linux $ vilanet-cli settings set routing_mode global # everything through tunnel $ vilanet-cli settings set network.block_stun true # prevent WebRTC IP leak $ vilanet-cli settings list # verify
Troubleshooting

Exit codes & common errors

Exit codes are stable across releases — your shell scripts can rely on them.

Logs at any verbosity are safe to share with VilaNet support; do not post them publicly.

Code Constant Meaning & resolution
0ExitSuccessNormal completion.
1ExitGenericBad flag, I/O failure, JSON-encoding error, or any unclassified error. Re-run with --debug for a stack trace.
2ExitAuthFailWrong password, or the login response could not be parsed. Re-run vilanet-cli login.
3ExitAccountClosedYour account is closed. Renew at VilaVPN.com or contact support.
4ExitNoCredentialsNo credentials stored, or you're rate-limited after too many login attempts. Wait a minute, then login again.
5ExitTUNPrivilegesTUN device needs sudo, a setcap'd binary, or Administrator. Re-run elevated, or use --no-tun --mixed 127.0.0.1:1080.
9ExitWindowsDaemonconnect --background is unsupported on Windows. Install the Windows Service instead.

"no daemon active"

You called status, switch, or disconnect with no background daemon running. Start one with connect --background (Unix) or the Service (Windows).

"another vilanet-cli daemon is already running"

A previous daemon is still alive. Run vilanet-cli disconnect, then try again. If the PID is stale, delete the socket file in the cache directory.

node ID "..." not found

The node ID changed (rare — it's a stable hex digest of the underlying server). Run vilanet-cli list servers --json to get the current ID, then retry.

Headless server, no keyring

CI runners and bare servers usually don't have libsecret. Pass --insecure-store on both login and connect — credentials go into a 0600 file under the config dir instead of the keyring.

AI assistants

Drive vilanet-cli with your AI

vilanet-cli ships a universal Agent Skill at ai/vilanet-cli/SKILL.md — a single plain-markdown file that teaches Claude Code, Codex CLI, Gemini CLI, Cursor, Cline, Aider, Copilot CLI, and any other modern AI assistant how to drive the CLI on your behalf. Install once, then ask your AI to connect, switch nodes, diagnose an exit code, or change a setting.

Claude Code

Drop the skill file into ~/.claude/skills/vilanet-cli/SKILL.md. Claude Code auto-discovers it on next start, so any new session can run vilanet-cli end-to-end.

$ mkdir -p ~/.claude/skills/vilanet-cli $ curl -fsSL https://testingcf.jsdelivr.net/gh/vilavpn/vilanet-cli@main/ai/vilanet-cli/SKILL.md \ -o ~/.claude/skills/vilanet-cli/SKILL.md

Gemini CLI ≥ 0.41

Use native Agent Skills support. From a local checkout the skills link form is the fastest path; on older Gemini builds, append a @./relative-path import to GEMINI.md instead.

$ gemini skills install https://github.com/vilavpn/vilanet-cli.git --path ai/vilanet-cli # Or from a local checkout: $ gemini skills link ./ai/vilanet-cli

Codex CLI · Cursor · Cline · Aider · Copilot CLI

The skill content is identical across every tool — only the install path differs. Write to a neutral location, then point your AI at it (and, for tools that read AGENTS.md, append idempotently rather than overwriting).

$ mkdir -p .agents/skills/vilanet-cli $ curl -fsSL https://testingcf.jsdelivr.net/gh/vilavpn/vilanet-cli@main/ai/vilanet-cli/SKILL.md \ -o .agents/skills/vilanet-cli/SKILL.md # For tools that only read AGENTS.md, append (idempotent — re-runs are a no-op): $ grep -qxF '## VilaNet CLI Agent Skill' AGENTS.md 2>/dev/null || \ { echo; echo '## VilaNet CLI Agent Skill'; cat .agents/skills/vilanet-cli/SKILL.md; } >> AGENTS.md

Once installed, here's how you talk to it

You don't need to memorise CLI flags. Once the skill is loaded, just describe what you want in plain language — examples below are the kind of thing you can paste into your AI chat.

Connect me to a Hong Kong node.
This node feels slow — switch me to a different one.
Start a background SOCKS5 proxy on 127.0.0.1:1080 so I can point my browser at it.
I just got exit code 5 from vilanet-cli connect. What's wrong and how do I fix it?
Route everything through the tunnel — including traffic to mainland Chinese sites.
Install vilanet-cli as a Windows Service so it survives reboots.
Fix the TUN permissions on my Linux box so I don't need sudo every time I connect.

Your AI translates the request into the right vilanet-cli invocation, runs it, and explains the result back in plain language.