中文 | English
Automatically toggle VPN according to Ethernet and Wi-Fi, only supported on macOS.
When connected to Ethernet or specified Wi-Fi networks, the VPN will be turned off. When connected to other Wi-Fi networks, the VPN will be turned on.
Run auto-toggle-vpn -g
to generate an example configuration file at ~/.local/auto-toggle-vpn/config.json.example
, and open it to make the necessary modifications as instructed.
{
"vpnname": "Enter your vpn_name",
"ssidlist": [
"SSID_1",
"SSID_2"
]
}
Find your VPN name under "System Preferences" - "VPN" and enter it for "vpnname"
. You can also get the VPN name using networksetup -listallnetworkservices
.
Then, add the Wi-Fi names to be considered in the "ssidlist"
array. After filling in the details, rename the file to "config.json".
brew tap moesnow/tools
brew install auto-toggle-vpn
brew services start auto-toggle-vpn
brew services stop auto-toggle-vpn
auto-toggle-vpn
Usage: auto-toggle-vpn [options]
Options:
-g, --generate : Generate config file example
-v, --version : Display program version
-h, --help : Display this help message
- Allow customization of when VPN should be enabled or disabled.
- Add graphical user interface.
brew install nlohmann-json
git clone https://github.com/moesnow/auto-toggle-vpn
cd auto-toggle-vpn
make