I'm implementing a DNS Proxy network extension on iOS 12 and I have a couple of simple questions, mostly due to the lack of documentation.
1) Implementing
I need to handle all the different cases of the `NEProviderStopReason` enum. Every case could possibly be really different from another and I'll need to perform different actions like communicating special states to the main App, try to recover in some way and so on.
here the enum:
/*! @const NEProviderStopReasonNone No specific reason. */
case none
/*! @const NEProviderStopReasonUserInitiated The user stopped the provider. */
case userInitiated
/*! @const NEProviderStopReasonProviderFailed The provider failed. */
case providerFailed
/*! @const NEProviderStopReasonNoNetworkAvailable There is no network connectivity. */
case noNetworkAvailable
/*! @const NEProviderStopReasonUnrecoverableNetworkChange The device attached to a new network. */
case unrecoverableNetworkChange
/*! @const NEProviderStopReasonProviderDisabled The provider was disabled. */
case providerDisabled
/*! @const NEProviderStopReasonAuthenticationCanceled The authentication process was cancelled. */
case authenticationCanceled
/*! @const NEProviderStopReasonConfigurationFailed The provider could not be configured. */
case configurationFailed
/*! @const NEProviderStopReasonIdleTimeout The provider was idle for too long. */
case idleTimeout
/*! @const NEProviderStopReasonConfigurationDisabled The associated configuration was disabled. */
case configurationDisabled
/*! @const NEProviderStopReasonConfigurationRemoved The associated configuration was deleted. */
case configurationRemoved
/*! @const NEProviderStopReasonSuperceded A high-priority configuration was started. */
case superceded
/*! @const NEProviderStopReasonUserLogout The user logged out. */
case userLogout
/*! @const NEProviderStopReasonUserSwitch The active user changed. */
case userSwitch
/*! @const NEProviderStopReasonConnectionFailed Failed to establish connection. */
case connectionFailed
Apart from a few cases (userInitiated, configurationDisabled, configurationRemoved) the other cases are quite obscure, would be possible to have a better description and use cases for all of them?
2) Debugging the network extension and disabling it from the App using
NEDNSProxyManager.shared().isEnabled = false
I've noticed that the `stop` function is called twice, the first time with 'configurationDisabled' reason and the second time, ofter after several seconds, with `userInitiated` reason.
Is this a wanted behaviour, if yes, what's the reason? At the moment I'm ignoring the second call but it doesn't seem a future-proof approach.
Thank you.