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.
func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void)
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. */
/*! @const NEProviderStopReasonUserInitiated The user stopped the provider. */
/*! @const NEProviderStopReasonProviderFailed The provider failed. */
/*! @const NEProviderStopReasonNoNetworkAvailable There is no network connectivity. */
/*! @const NEProviderStopReasonUnrecoverableNetworkChange The device attached to a new network. */
/*! @const NEProviderStopReasonProviderDisabled The provider was disabled. */
/*! @const NEProviderStopReasonAuthenticationCanceled The authentication process was cancelled. */
/*! @const NEProviderStopReasonConfigurationFailed The provider could not be configured. */
/*! @const NEProviderStopReasonIdleTimeout The provider was idle for too long. */
/*! @const NEProviderStopReasonConfigurationDisabled The associated configuration was disabled. */
/*! @const NEProviderStopReasonConfigurationRemoved The associated configuration was deleted. */
/*! @const NEProviderStopReasonSuperceded A high-priority configuration was started. */
/*! @const NEProviderStopReasonUserLogout The user logged out. */
/*! @const NEProviderStopReasonUserSwitch The active user changed. */
/*! @const NEProviderStopReasonConnectionFailed Failed to establish connection. */
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.