Skip to content

alxmtzr/vpn-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VPN Logo

vpn-cli

A small interactive CLI wrapper for VPN command-line tools.

Originally built for ProtonVPN Free, but designed to be easily adaptable to other VPN providers by swapping backend commands.


πŸ“– Table of Contents

  1. Features
  2. Example: Country Selection
  3. Requirements
  4. Setup after cloning
  5. Installation
  6. Uninstall
  7. ProtonVPN Setup (Reference Provider)
  8. Usage
  9. Provider Configuration
  10. Supported VPN Providers
  11. Repository Structure
  12. Design Philosophy
  13. License

✨ Features

  • Interactive country selection (arrow keys + Enter via fzf)
  • Direct connect via country code
  • Simple alias-free CLI (vpn connect)
  • Provider-based design (ProtonVPN as reference)
  • Install / Uninstall scripts with interactive dependency checks

πŸ–Ό Example: Country Selection

Country Selection Screenshot

Use ↑ / ↓ to navigate, type to filter, Enter to select.


πŸ“¦ Requirements

  • Bash (must be available on the system)
  • fzf (interactive selector) – if not installed, install.sh can install it for you
  • A supported VPN CLI tool (e.g., protonvpn-cli) – if not installed, install.sh can install it for you

πŸ’‘ Note: You normally do not need to install these manually. Running install.sh will check for missing dependencies and offer to install them automatically.


πŸ”§ Setup after cloning

You can clone directly into ~/.config/vpn-cli to simplify provider management:

mkdir -p ~/.config/vpn-cli
git clone https://github.com/alxmtzr/vpn-cli.git ~/.config/vpn-cli

Make all scripts executable:

chmod +x ~/.config/vpn-cli/vpn \
         ~/.config/vpn-cli/install.sh \
         ~/.config/vpn-cli/uninstall.sh \
         ~/.config/vpn-cli/providers/*.sh

Optional: create a config file:

echo 'PROVIDER="protonvpn"' > ~/.config/vpn-cli/config

πŸš€ Installation

Option A: Use the included install script

~/.config/vpn-cli/install.sh
  • Checks for dependencies (fzf, protonvpn-cli) individually
  • Prompts to install missing dependencies
  • Installs vpn globally to /usr/local/bin

Option B: Manual installation

sudo cp ~/.config/vpn-cli/vpn /usr/local/bin/vpn

After installation, the vpn command is available globally. No alias required.


πŸ—‘ Uninstall

Run the uninstall script:

~/.config/vpn-cli/uninstall.sh
  • Removes the vpn command
  • Checks if fzf or protonvpn-cli are installed and prompts to uninstall each
  • Supports zypper / apt / pacman

Or manually:

sudo rm /usr/local/bin/vpn

πŸ” ProtonVPN Setup (Reference Provider)

ProtonVPN

To use the ProtonVPN provider, you must have a ProtonVPN Free account.

Login once with your ProtonVPN credentials:

vpn login

⚠️ Note: Without a ProtonVPN account, the ProtonVPN provider will not work.


🧭 Usage

Show help

vpn --help

Connect interactively

vpn connect
  • Use ↑ / ↓ to navigate
  • Type to filter
  • Press Enter to connect
  • Press Esc to cancel

Connect directly to a country

vpn connect US
vpn connect NL

Disconnect

vpn disconnect

Show status

vpn status

βš™οΈ Provider Configuration

The VPN backend is abstracted via provider scripts.

Default provider:

~/.config/vpn-cli/providers/protonvpn.sh

To support another VPN provider:

  1. Copy an existing provider script (e.g., protonvpn.sh) to a new file (e.g., mullvad.sh)
  2. Replace connect / disconnect / status commands
  3. Adjust available countries if needed

Example:

vpn_provider_connect() {
    nordvpn connect "$1"
}

🧩 Supported VPN Providers

Provider Status
ProtonVPN βœ… Reference implementation
Mullvad ❌ Example only
NordVPN ❌ Example only
OpenVPN ❌ Example only

πŸ—‚ Repository Structure

vpn-cli/                 # Root of the project
β”œβ”€β”€ vpn                  # Main CLI script (global executable)
β”œβ”€β”€ install.sh           # Installation script
β”œβ”€β”€ uninstall.sh         # Uninstallation script
β”œβ”€β”€ README.md            # Project README
β”œβ”€β”€ LICENSE              # MIT License
β”œβ”€β”€ providers/           # Folder containing provider scripts
β”‚   └── protonvpn.sh
β”œβ”€β”€ assets/              # Images for README
β”‚   β”œβ”€β”€ protonvpn-logo.png
β”‚   └── country-selection.png
└── config/              # Optional user config (created by user)
    └── config           # e.g., PROVIDER="protonvpn"

Cloning directly into ~/.config/vpn-cli simplifies usage and provider management.


πŸ›  Design Philosophy

  • Simple Bash
  • No heavy frameworks
  • Interactive but scriptable
  • One command, predictable behavior
  • Provider-based for easy extension

πŸ“œ License

MIT

About

A small interactive CLI wrapper for VPN command-line tools.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages