VPN Protocol
The SDK supports three VPN protocols plus automatic selection:
KapeVpnProtocol | Description |
|---|---|
Automatic | The daemon picks the best protocol |
Lightway | Lightway — ExpressVPN's proprietary protocol |
OpenVpn | OpenVPN — broadly compatible TLS-based VPN |
WireGuard | WireGuard |
Lightway and OpenVPN run over UDP or TCP, chosen with KapeVpnTransport:
KapeVpnTransport | Description |
|---|---|
Automatic | UDP for Lightway and OpenVPN; WireGuard has no choice |
Udp | Fastest; the usual choice |
Tcp | For networks that block UDP |
Changing the Protocol
await vpn.SetSelectedProtocolAsync(KapeVpnProtocol.Lightway, KapeVpnTransport.Tcp);
await vpn.SetSelectedProtocolAsync(KapeVpnProtocol.WireGuard); // transport defaults to Automatic
The daemon persists the selection. Changes apply to the next VPN connection. If the tunnel is currently active, disconnect and reconnect to use the new protocol.
Reading the Selected Protocol
vpn.SelectedProtocol // KapeVpnProtocol — what the next connection will use
vpn.SelectedTransport // KapeVpnTransport
Reading the Connected Protocol
SelectedProtocol is the protocol that will be used on the next connection.
To read what the tunnel is actually connected with — which differs from the
selection when Automatic resolves it — read the connected values while the
status is Connected:
vpn.ConnectedProtocol // KapeVpnProtocol?, null when not connected
vpn.ConnectedTransport // KapeVpnTransport?, null when not connected