Repository navigation
Description
Problem
Each VPN app needs its own store package, and each one polls a script for the same few facts:
- Proton VPN greps
scutil --nc listevery 5 s for its status, and opens the app's menu to connect. - Tunnelblick asks the app over AppleScript every 5 s.
- OpenVPN Connect (stablebar-packages#60, #61) reads
scutil --nc list,showandstatus,netstatand the app's profile store withjq. While connected it runs every 2 s for its speeds and graph, about 0.1 s of CPU each time, and keeps the graph's history in a file in$TMPDIRbetween runs. It connects and disconnects withscutil --nc startandstop, because the app's own command line shows its window.
Most of that is what System Settings → VPN already knows: every VPN configured in macOS (IKEv2, IPSec, L2TP) and every app VPN built on Network Extension (OpenVPN Connect, Tailscale, Proton VPN, WireGuard, recent corporate clients), each with its status and an on/off switch. The network provider can't help here: it leaves virtual VPN interfaces out on purpose, so showing a VPN's own speed takes a script reading netstat.
Proposal
A native vpn provider for the VPN services in the current network set, as scutil --nc list lists them:
lists.services: a row per service withid(the service ID),name,type(whatscutilshows in parentheses: the app's bundle ID, such asorg.openvpn.client.app, or Apple's for a VPN configured in macOS),status(connected,connecting,disconnectingordisconnected),interfacewhile it's up (such asutun7),downloadanduploadin bytes per second, anddownloadRateanduploadRateformatted withunits, asnetworkdoes.values.connected: how many are connected.fields.connected: their names.icon: one symbol while any is connected, another while none is.- A
typesoption that keeps only some services, such as"types": ["org.openvpn.client.app"], so a package for one app can use the provider for its tunnels and add only what the app adds. - Status follows macOS as it changes, without polling, as
wifidoes. Rates update onintervaland add graph samples, likenetwork. connectVPNFieldanddisconnectVPNField, reading a service ID from the current row asselectOutputDeviceFielddoes, start or stop the service the way System Settings does.
Things to settle:
- Stopping works for every service. Starting an app's VPN from outside the app depends on its extension. OpenVPN Connect's reads the profile named in the service's configuration (
ovpnProfileId) and connects it cleanly; another app's may connect its last server or need its app. A row could offer Connect only for types known to start cleanly, or for all of them. - Listing app VPNs and reading their status may need SystemConfiguration calls that aren't public. Show connected Bluetooth devices and their battery #220 allows a native provider to run a macOS tool off the main actor and without a shell, so the provider could run
scutilitself where no public API covers it. - VPNs that don't use Network Extension, such as Tunnelblick, don't appear, so their packages stay.
This adds a provider type, so it needs a maintainer's OK.
Possible today
Yes, with a script per app: scutil --nc list for the status, scutil --nc show <id> for an app's configuration, scutil --nc status <id> for the interface, netstat -ibn -I <interface> for the byte counts kept in a file to compute speeds and history, and scutil --nc start or stop <id> to switch it. The OpenVPN Connect package does all of it. Each package repeats it, polls every few seconds, and keeps its graph's history in a file instead of the widget's samples.
Related
- Store packages that read VPN state: Proton VPN, Tunnelblick, Tailscale, and OpenVPN Connect (stablebar-packages#60, #61).
- The
networkprovider leaves VPN interfaces out (Providers). - Show connected Bluetooth devices and their battery #220: a native provider may run a macOS tool when no public API gives the data.
- No open or closed issue or pull request covers VPNs.
Triaged by Claude Code (Claude Opus 5.5).
Activity