<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NEAppProxyProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NEAppProxyProvider"
  },
  "title" : "NEAppProxyProvider"
}
-->

# NEAppProxyProvider

The principal class for an app proxy provider app extension.

```
class NEAppProxyProvider
```

## Overview

The [`NEAppProxyProvider`](/documentation/NetworkExtension/NEAppProxyProvider) class provides access to flows of network data in the form of [`NEAppProxyFlow`](/documentation/NetworkExtension/NEAppProxyFlow) objects. Each [`NEAppProxyFlow`](/documentation/NetworkExtension/NEAppProxyFlow) object corresponds to a socket opened by an app that matches the app rules specified in the current App Proxy configuration. Your App Proxy Provider acts as a transparent network proxy for the flows of network data that it receives.

> Important:
> The `com.apple.developer.networking.networkextension` entitlement is required to use the ``doc://com.apple.networkextension/documentation/NetworkExtension/NEAppProxyProvider`` class. Enable this entitlement when creating an App ID in your developer account.

### DNS Handling

In addition to flows of raw network data from applications, the App Proxy Provider also receives flows of DNS queries in the form of [`NEAppProxyUDPFlow`](/documentation/NetworkExtension/NEAppProxyUDPFlow) objects. DNS query flows are received only for applications that use low-level DNS resolution APIs such as <doc://com.apple.documentation/documentation/dnssd/DNSServiceGetAddrInfo(_:_:_:_:_:_:_:)>(). The App Proxy Provider can specify the DNS resolver configuration that will be used by these applications using the [`setTunnelNetworkSettings(_:completionHandler:)`](/documentation/NetworkExtension/NETunnelProvider/setTunnelNetworkSettings(_:completionHandler:)) method.

Applications that use higher-level networking APIs such as <doc://com.apple.documentation/documentation/Foundation/URLSession> and <doc://com.apple.documentation/documentation/Foundation/NSURLConnection> do not generate DNS queries. Instead the destination hostname for the connection is included in the endpoint information of the [`NEAppProxyFlow`](/documentation/NetworkExtension/NEAppProxyFlow) object.

### Creating an App Proxy Provider Extension

App Proxy Providers run as App Extensions for the `com.apple.networkextension.app-proxy` extension point.

To create a App Proxy Provider extension, first create a new App Extension target in your project.

For an example of an Xcode build target for this app extension, see the [SimpleTunnel: Customized Networking Using the NetworkExtension Framework](https://developer.apple.com/library/archive/samplecode/SimpleTunnel/Introduction/Intro.html#//apple_ref/doc/uid/TP40016140) sample code project.

Once you have a App Proxy Provider extension target, create a sub-class of `NEAppProxyProvider`. Then, set the `NSExtensionPrincipalClass` key in the the extension’s `Info.plist` to the name of your sub-class.

If it is not already done, set the `NSExtensionPointIdentifier` key in the extension’s `Info.plist` to `com.apple.networkextension.app-proxy`.

Here is an example of the NSExtension dictionary in a App Proxy Provider extension’s `Info.plist`:

```xml
<key>NSExtension</key>
<dict>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.networkextension.app-proxy</string>
    <key>NSExtensionPrincipalClass</key>
    <string>MyCustomAppProxyProvider</string>
</dict>
```

Finally, add your App Proxy Provider extension target to your app’s Embed App Extensions build phase.

### Subclassing Notes

In order to create a App Proxy Provider extension, you must create a subclass of `NEAppProxyProvider` and override the methods listed below.

#### Methods to Override

- [`startProxy(options:completionHandler:)`](/documentation/NetworkExtension/NEAppProxyProvider/startProxy(options:completionHandler:))
- [`stopProxy(with:completionHandler:)`](/documentation/NetworkExtension/NEAppProxyProvider/stopProxy(with:completionHandler:))
- [`handleNewFlow(_:)`](/documentation/NetworkExtension/NEAppProxyProvider/handleNewFlow(_:))

## Topics

### Managing the app proxy life cycle

[`-  startProxyWithOptions:completionHandler:`](/documentation/NetworkExtension/NEAppProxyProvider/startProxy(options:completionHandler:))

Start the network proxy.

[`-  stopProxyWithReason:completionHandler:`](/documentation/NetworkExtension/NEAppProxyProvider/stopProxy(with:completionHandler:))

Stop the network proxy.

[`-  cancelProxyWithError:`](/documentation/NetworkExtension/NEAppProxyProvider/cancelProxyWithError(_:))

Stop the network proxy from the App Proxy Provider.

### Handling proxied flows

[`-  handleNewFlow:`](/documentation/NetworkExtension/NEAppProxyProvider/handleNewFlow(_:))

Handle a new flow of network data.

[`-  handleNewUDPFlow:initialRemoteEndpoint:`](/documentation/NetworkExtension/NEAppProxyProvider/handleNewUDPFlow(_:initialRemoteEndpoint:))

Handle a new UDP flow of network data.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NETunnelProvider`](/documentation/NetworkExtension/NETunnelProvider)

### Inherited By

[`NETransparentProxyProvider`](/documentation/NetworkExtension/NETransparentProxyProvider)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)