One Logo Pool Ball
NetworkExtension · IOS API REFERENCE

NEPacketTunnelProvider

class · iOS 9.0+ · SDK 27.1

class NEPacketTunnelProvider

Members (6)

method · iOS 9.0+

cancelTunnelWithError

TypeScript
cancelTunnelWithError(error?: (NativeError) | null): void
Swift declaration
func cancelTunnelWithError(_ error: (any Error)?)
init

init

TypeScript
static init(): NEPacketTunnelProvider
Swift declaration
init()
method · iOS 9.0+

startTunnel

TypeScript
startTunnel(options: (Record<string, _ObjectiveC_NSObject>) | null, completionHandler: ((arg0: (NativeError) | null) => void)): void
Swift declaration
func startTunnel(options: [String : NSObject]? = nil) async throws
method · iOS 9.0+

stopTunnel

TypeScript
stopTunnel(reason: NEProviderStopReason, completionHandler: (() => void)): void
Swift declaration
func stopTunnel(with reason: NEProviderStopReason) async
get · iOS 9.0+

packetFlow

TypeScript
get packetFlow(): NEPacketTunnelFlow
Swift declaration
var packetFlow: NEPacketTunnelFlow { get }
get · iOS 18.0+

virtualInterface

TypeScript
get virtualInterface(): (_Network_NWInterface) | null
Swift declaration
var virtualInterface: NWInterface? { get }

The virtual network interface used to route packets to the packet tunnel provider. For NEPacketTunnelProvider sub-classes, this property will be non-nil when `NEPacketTunnelProvider.startTunnel(options:)` is called. For NEEthernetTunnelProvider sub-classes, this property will be non-nil after `NETunnelProvider.setTunnelNetworkSettings(_:)` returns. To create a connection through the tunnel, set this interface as `NWParameters.requiredInterface`.

Skipped declarations

2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

NEPacketTunnelProvider.createTCPConnectionThroughTunnel(to:enableTLS:tlsParameters:delegate:)

The iOS SDK compiler rejected this binding: 'NWEndpoint' is ambiguous for type lookup in this context

NEPacketTunnelProvider.createUDPSessionThroughTunnel(to:from:)

The iOS SDK compiler rejected this binding: 'NWEndpoint' is ambiguous for type lookup in this context

All NetworkExtension types →