---
title: "startProxy(options:completionHandler:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/nednsproxyprovider/startproxy(options:completionhandler:)"
---

# startProxy(options:completionHandler:)

Starts the DNS proxy.

## Declaration

```swift
func startProxy(options: [String : Any]? = nil, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func startProxy(options: [String : Any]? = nil) async throws
```

## Parameters

- `options`: A dictionary that you define as part of a device configuration profile. You can also modify the contents of this dictionary from your app using the shared instance of doc://com.apple.networkextension/documentation/NetworkExtension/NEDNSProxyManager. The dictionary appears as the doc://com.apple.networkextension/documentation/NetworkExtension/NEDNSProxyProviderProtocol/providerConfiguration component of the manager’s doc://com.apple.networkextension/documentation/NetworkExtension/NEDNSProxyManager/providerProtocol property.
- `completionHandler`: A block that you must execute when the proxy is fully established, or when the proxy cannot be started due to an error. If the proxy is successfully established, the error parameter should be set to nil. Otherwise, the error parameter passed to this block indicates the reason for failure.

## Discussion

Discussion Subclasses of NEDNSProxyProvider must override this method to perform any necessary steps to ready the proxy for handling flows of network data. The framework calls this method when a new proxy instance is created. You indicate that setup is complete by calling the completion handler with a nil error parameter, or that setup failed by calling the completion handler with an error instance. You define the error domain and code.

## See Also

### Managing the DNS proxy life cycle

- [stopProxy(with:completionHandler:)](networkextension/nednsproxyprovider/stopproxy(with:completionhandler:).md)
- [cancelProxyWithError(_:)](networkextension/nednsproxyprovider/cancelproxywitherror(_:).md)
