Effortless WireGuard Endpoint Rotation
A lightweight CLI tool built for users with hundreds of VPN profiles (like Mullvad). Seamlessly switch between global endpoints or filter by country code in a single keystroke.
Key Features
Engineered with Unix simplicity and reliability in mind.
Random Endpoint Selection
Picks a random WireGuard configuration file from your configuration directory using native Unix shuf.
Country-Specific Filtering
Filter configurations dynamically by ISO country code prefix (e.g. wgu us, wgu se).
Automatic Clean Teardown
Ships with wgd to automatically detect active WireGuard interfaces and cleanly bring them down before rotating.
Zero Dependencies
Written completely in clean Bash. Runs directly on Debian, Ubuntu, Arch, Fedora, Alpine, or macOS with standard WireGuard packages.
Flexible Configuration
Supports environment variables (WG_DIR) or dedicated config files (~/.config/wgu/config).
Auto DNS Recovery
Includes fallback triggers for resolvconf -u if DNS resolution gets hung during network interfaces switches.
Installation
First, ensure WireGuard tools (wg-quick) are installed on your machine.
Command Usage & Syntax
Rotate endpoints instantly with straightforward commands.
#1 Random Worldwide Rotation
Randomly selects any WireGuard configuration in your directory:
#2 Target Country Code
Restricts random selection to files matching country prefix:
wgu se # Sweden
wgu ch # Switzerland
Configuration Reference
By default, wgu scans /etc/wireguard. You can configure it via environment variables or a configuration file.
| Variable | Default | Description |
|---|---|---|
| WG_DIR | /etc/wireguard | Directory containing WireGuard .conf files |
| VERBOSITY | 1 | Logging output detail (1 = status, 10+ = bash tracing) |
| WG_D_B4_U | 1 | Automatically run wgd to bring down existing connections before starting |
wgd: The Graceful WireGuard Teardown Tool
Inspects active interfaces via sudo wg and runs wg-quick down on all active configurations safely.