Package com.codename1.vpn


package com.codename1.vpn

Installing and controlling a VPN configuration.

What is realistic here, and what is not

There are two very different things called "VPN support", and conflating them wastes a lot of time:

  • Asking the operating system to run a standard tunnel -- an IKEv2 or IPsec configuration the platform itself implements. Portable, needs a capability any paid developer account can switch on, and is what almost every app that says "connect to VPN" actually wants. That is com.codename1.vpn.profile.
  • Shipping a tunnel of your own, which receives raw IP packets and decides what to do with them. That is a much larger commitment: on iOS it runs in a Network Extension, a separate process with its own bundle, and its entitlement -- com.apple.developer.networking.networkextension -- is one Apple grants case by case rather than one a paid account switches on; on Android it is a VpnService in the app's own process. The two platforms hand packets over differently, so any portable shape has to expose that difference rather than hide it.
Detecting a VPN is a different question and already answered

com.codename1.io.NetworkManager#isVPNActive() reports whether any VPN is carrying this device's traffic, works on far more platforms than can install one, and needs no entitlement. An app that only wants to refuse to run behind a VPN, or to warn about one, should use that and reference nothing here.

This package itself holds only the shared value types -- VpnStatus, VpnError, VpnException and VpnProtocol. Referencing it alone costs nothing.

  • Class
    Description
    Typed error codes carried by VpnException.
    Thrown through the failure path of every AsyncResource returned by the com.codename1.vpn APIs.
    The tunnelling protocol a configuration uses.
    Where a VPN connection is in its life.