Interface IVpnManager
interface IVpnManager
Extends com.amazon.apmf.IStandard
Base interface for managing VPN connections.
Provides generic VPN operations that are common across all VPN types.
Methods
createVpn()
Creates a VPN interface with the provided configuration. The interface name will be defined by the system. Applications should listen for VPN interface up events to be notified when the interface is ready.voidcreateVpn(com.amazon.kepler.net.vpn.common.VpnConfig*config)
Parameters
config
com.amazon.kepler.net.vpn.common.VpnConfig* — Required
The VPN configuration containing interface settings, routing rules,
and protocol-specific configuration (only WireGuard for now).
Must not be null.
Throws
SecurityError— if the caller lacks the required permissionInvalidArgumentError— if the configuration is invalid or parameters are out of rangeOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
getVpnConfig()
Get the current VPN configuration.com.amazon.kepler.net.vpn.common.VpnConfig?getVpnConfig()
Returns
com.amazon.kepler.net.vpn.common.VpnConfig?
The return value is optional and might be absent.
The current VPN configuration or null if none exists.
Throws
SecurityError— if the app does not have the permissionOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
getVpnState()
com.amazon.kepler.net.vpn.common.VpnState getVpnState()
Get the current VPN state.
Returns
com.amazon.kepler.net.vpn.common.VpnState
The current VPN state.
Throws
SecurityError— if the app does not have the permissionOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.network-access
addDnsServer()
Adds a DNS server to the VPN connection. Must be called atvoidaddDnsServer(stringipAddr)
INTF_UP state after createVpn and before startVpn.
Parameters
ipAddr
string — Required
The IP address of the DNS server in standard notation
(e.g. “192.168.1.1” for IPv4 or “2001:db8::1” for IPv6)
Throws
SecurityError— if the caller lacks the required permissionInvalidArgumentError— if ipAddr is not a valid IP address or maximum DNS servers exceededInvalidOperationError— if VPN is not configured or called at wrong stateOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
addRoute()
Add a network route to the VPN interface. Both IPv4 and IPv6 routes are supported. Adding a route implicitly allows traffic from that address family (i.e., IPv4 or IPv6) to be routed over the VPN. Must be called atvoidaddRoute(stringipAddr)
INTF_UP state after createVpn and before startVpn.
Parameters
ipAddr
string — Required
The IP address with prefix to add as a route.
Throws
SecurityError— if the app does not have the permissionInvalidArgumentError— if ipAddr is not a valid IP address or maximum routes exceededInvalidOperationError— if VPN is not configuredOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
deleteRoute()
Exclude a network route from the VPN interface. Both IPv4 and IPv6 routes are supported. Must be called atvoiddeleteRoute(stringipAddr)
INTF_UP state after createVpn and before startVpn.
Parameters
ipAddr
string — Required
The IP address with prefix to exclude as a route.
Throws
SecurityError— if the app does not have the permissionInvalidArgumentError— if ipAddr is not a valid IP addressInvalidOperationError— if VPN is not configured or called at wrong stateOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
addInterfaceAddress()
Add a network address to the VPN interface. Both IPv4 and IPv6 addresses are supported. At least one address must be set before starting the VPN.voidaddInterfaceAddress(stringipAddr)
Parameters
ipAddr
string — Required
The IP address with prefix to add to the interface.
Throws
SecurityError— if the app does not have the permissionInvalidArgumentError— if ipAddr is not a valid IP address or maximum addresses exceededInvalidOperationError— if VPN is not configuredOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
deleteInterfaceAddress()
Remove a network address from the VPN interface. Must be called atvoiddeleteInterfaceAddress(stringipAddr)
INTF_UP state after createVpn and before startVpn.
Parameters
ipAddr
string — Required
The IP address with prefix to remove from the interface.
Throws
SecurityError— if the app does not have the permissionInvalidArgumentError— if ipAddr is not a valid IP addressInvalidOperationError— if VPN is not configured or called at wrong stateOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
setMtu()
Set the maximum transmission unit (MTU) of the VPN interface.voidsetMtu(u16mtu)
Parameters
mtu
u16 — Required
The MTU value to set.
Throws
SecurityError— if the app does not have the permissionInvalidArgumentError— if mtu is invalid or out of valid rangeInvalidOperationError— if VPN is not configuredOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
startVpn()
void startVpn()
Start the VPN connection.
Sets up the VPN connection.
Throws
SecurityError— if the app does not have the permissionOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
stopVpn()
void stopVpn()
Stop the VPN connection.
Tears down the VPN connection.
Throws
SecurityError— if the app does not have the permissionOutOfMemoryError— if memory allocation failsBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
addVpnEventListener()
Register a listener for VPN events.voidaddVpnEventListener(IVpnEventListener*listener)
Parameters
listener
IVpnEventListener* — Required
The listener to register.
Throws
SecurityError— if the app does not have the permissionInvalidOperationError— if listener already existsInvalidArgumentError— if listener is nullBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl
removeVpnEventListener()
void removeVpnEventListener()
Unregister the VPN event listener.
Throws
SecurityError— if the app does not have the permissionBaseError— for other errors
com.amazon.network.privilege.net-vpn-ctrl

