Interface IWireGuardManager
interface IWireGuardManager
Extends com.amazon.apmf.IStandard
Standalone WireGuard manager interface.
Provides APIs to manage WireGuard tunnel interfaces independently
from the generic VPN manager.
Methods
createInterface()
Create a WireGuard interface. This is an asynchronous operation. On success, a WG_STATE_UP event is delivered. On failure, a WG_CREATE_FAILURE event is delivered.voidcreateInterface(WgInterfaceConfig*ifConfig)
Parameters
ifConfig
WgInterfaceConfig* — Required
the interface configuration. The IP field is mandatory.
Listen port and private key are optional.
Throws
SecurityError— if the app does not have the permission.NullPointerError— if ifConfig is null.InvalidArgumentError— if configuration is invalid.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
removeInterface()
Remove a WireGuard interface. This is an asynchronous operation.voidremoveInterface(u8interfaceId)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
Throws
SecurityError— if the app does not have the permission.InvalidArgumentError— if the interface is not a WireGuard interface.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
getState()
Get the current WireGuard interface state.WgStategetState(u8interfaceId)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
Returns
WgState
the current WireGuard state.
Throws
SecurityError— if the app does not have the permission.InvalidArgumentError— if the interface is not a WireGuard interface.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
getConfig()
Get the full WireGuard configuration including interface and peers.WgConfig?getConfig(u8interfaceId)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
Returns
WgConfig?
The return value is optional and might be absent.
the WireGuard configuration.
Throws
SecurityError— if the app does not have the permission.InvalidArgumentError— if the interface is not a WireGuard interface.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
updateInterface()
Update WireGuard interface configuration. This is an asynchronous operation. Multiple fields can be updated by combining update type flags.voidupdateInterface(u8interfaceId,WgUpdateInterfaceupdateType,WgInterfaceConfig*ifConfig)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
updateType
WgUpdateInterface — Required
bitmask of fields to update.
ifConfig
WgInterfaceConfig* — Required
the new interface configuration values.
Throws
SecurityError— if the app does not have the permission.NullPointerError— if ifConfig is null.InvalidArgumentError— if updateType is invalid or interface is not WireGuard.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
addPeer()
Add a remote peer to the WireGuard interface. This is an asynchronous operation.voidaddPeer(u8interfaceId,WgPeerConfig*peerConfig)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
peerConfig
WgPeerConfig* — Required
the peer configuration.
Throws
SecurityError— if the app does not have the permission.NullPointerError— if peerConfig is null.InvalidArgumentError— if peer configuration is invalid or interface is not WireGuard.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
removePeer()
Remove a peer from the WireGuard interface. This is an asynchronous operation.voidremovePeer(u8interfaceId,u8[]peerPubKey)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
peerPubKey
u8[] — Required
the public key of the peer to remove (32 bytes).
Throws
SecurityError— if the app does not have the permission.NullPointerError— if peerPubKey is null.InvalidArgumentError— if the interface is not a WireGuard interface.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
updatePeer()
Update a WireGuard peer configuration. This is an asynchronous operation. Multiple fields can be updated by combining update type flags.voidupdatePeer(u8interfaceId,WgUpdatePeerupdateType,WgPeerConfig*peerConfig)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
updateType
WgUpdatePeer — Required
bitmask of fields to update.
peerConfig
WgPeerConfig* — Required
the new peer configuration values.
Throws
SecurityError— if the app does not have the permission.NullPointerError— if peerConfig is null.InvalidArgumentError— if updateType is invalid or interface is not WireGuard.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
setPeerKeepAlive()
Set the keepalive interval for a peer.voidsetPeerKeepAlive(u8interfaceId,u8[]peerPubKey,u16keepAliveSeconds)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
peerPubKey
u8[] — Required
the public key of the peer (32 bytes).
keepAliveSeconds
u16 — Required
keepalive interval in seconds. 0 disables keepalive.
Throws
SecurityError— if the app does not have the permission.NullPointerError— if peerPubKey is null.InvalidArgumentError— if the interface is not a WireGuard interface.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard
getPeerStats()
Get statistics for a specific peer.WgPeerStats?getPeerStats(u8interfaceId,u8[]peerPubKey)
Parameters
interfaceId
u8 — Required
the WireGuard interface identifier.
peerPubKey
u8[] — Required
the public key of the peer (32 bytes).
Returns
WgPeerStats?
The return value is optional and might be absent.
the peer statistics.
Throws
SecurityError— if the app does not have the permission.NullPointerError— if peerPubKey is null.InvalidArgumentError— if the interface is not a WireGuard interface.BaseError— on unexpected failure.
com.amazon.network.privilege.wireguard

