Skip to main content

VPN Protocol

The SDK supports three VPN protocols plus automatic selection:

KapeVpnProtocolDescription
AutomaticThe daemon picks the best protocol
LightwayLightway — ExpressVPN's proprietary protocol
OpenVpnOpenVPN — broadly compatible TLS-based VPN
WireGuardWireGuard

Lightway and OpenVPN run over UDP or TCP, chosen with KapeVpnTransport:

KapeVpnTransportDescription
AutomaticUDP for Lightway and OpenVPN; WireGuard has no choice
UdpFastest; the usual choice
TcpFor 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