A simple command-line tool to manage WireGuard connections by automatically selecting and applying random configuration files from a specified directory. Ideal for users who want to rotate between multiple WireGuard endpoints (e.g., Mullvad users with 500+ server locations).
- Random Configuration Selection: Choose a random WireGuard config file from a directory.
- Country-Specific Filtering: Select configs matching a specific country code (e.g.,
us
,se
). - Flexible Configuration: Customize the config directory via environment variables or config files.
- Zero Dependency Installation: Built as a Bash script with no external dependencies beyond WireGuard.
-
Ensure WireGuard is installed
This tool requireswg-quick
(part of the WireGuard package).
On Debian/Ubuntu:sudo apt install wireguard
-
Build and Install
./configure sudo make install
This installs the
wgu
script to your system's binary path.
wgu [COUNTRY_CODE]
-
Random worldwide config
wgu
-
Random US config
wgu us
-
Random Swedish config
wgu se
- No arguments: Randomly selects any
.conf
file in${WG_DIR}
. - Country code: Uses a regex pattern
.*/$1.*\.conf
to match filenames (e.g.,us-ams1.conf
forus
).
By default, wgu
uses /etc/wireguard
. To override this:
export WG_DIR=/path/to/your/configs
wgu
Create one of these files and add:
WG_DIR=/path/to/your/configs
~/.config/wgu/config
(preferred)~/.wgu_config
(fallback)
- Permissions: Requires
sudo
to apply WireGuard configurations. - Error Handling:
- If no config matches, an error is shown.
- If
wg-quick
is missing, the script exits with an error message.
This project is licensed under the terms of the GNU General Public License v3.0.