Specify the network settings for the current tunneling session.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+Beta
The network settings to use for the tunnel. Pass nil to clear out the network settings for the current tunneling session.
A block that will be executed when the operation of setting the network settings is complete. If the network settings could not be set due to an error, then the error parameter will be set to an
NSErrorobject containing more information about the error. See NETunnelProviderError for possible error codes. If the network settings were set successfully then the error parameter will be set to nil.
Use this method to specify the settings to be used by network communication that traverses the tunnel. If you are implementing a Packet Tunnel Provider, pass a
NEPacket object containing virtual IP configuration, DNS settings, proxy settings, the tunnel MTU, and IP routes. If you are implementing an App Proxy Provider, pass a
NETunnel containing DNS settings and proxy settings.
This method should be called as part of the process of establishing the tunnel, as follows:
The system calls the appropriate “start” method on the tunnel provider object.
The provider obtains the network settings for the tunnel by some means dictated by the tunnel provider, such as by downloading them from the tunnel server.
The tunnel provider calls
setmethod to apply the network settings to the system.
Tunnel Network Settings(_: completion Handler:)
The system executes the completion handler passed to
set: to indicate that the network settings have been set.
Tunnel Network Settings: completion Handler
The tunnel provider executes the completion handler block passed to the “start” method to indicate that the tunnel is fully established.