This is a simple script, written in rust, which allows you to easily enable a wireguard interface, disable one, toggle between them, and see which is currently active. This is mainly for personal usage. Which interface is chosen, is at random. It internally just calls wg-quick.
- Place all desired interfaces (.conf files) in /etc/wireguard.
- Bind shortcuts to sudo vpn_handler [arguments]. Please ensure you have a way of answering the sudo request command, eg. by pre-pending konsole -e, or another terminal (konsole -e sudo vpn_handler up, in my case)
- Call the executable on startup, eg. via a systemd service, if you want it to activate on startup.
swap - Swaps the active interface with another (internally just calls down then up) up - Brings an interface up, if one is not already active down - Brings the active interface down, if there is one which - Prints the active interface's name
Clone the repository, then simply run "cargo build --release", if you just want the pure executable. Otherwise, on arch-based distributions, run makepkg -si in the cloned repository to install the program. Dependencies are openresolv (or alternatives) and wireguard-tools, the makepkg automatically installs these otherwise you need to ensure you have them when building with cargo manually.