I configued a VPN and I want to handle all device's traffic.
In the class, PacketTunnelProvider how should I configure the NEPacketTunnelNetworkSettings ?
I tried something like this:
let newSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: serverAddress)
newSettings.IPv4Settings = NEIPv4Settings(addresses: [addressIGotFromServer], subnetMasks: ["0.0.0.0"])
newSettings.IPv4Settings?.includedRoutes = [NEIPv4Route.defaultRoute()]
let serverRoute = NEIPv4Route(destinationAddress: addressIGotFromServer, subnetMask: "255.255.255.255")
newSettings.IPv4Settings?.excludedRoutes = [serverRoute]
newSettings.IPv6Settings = NEIPv6Settings(addresses: anotheraddress, networkPrefixLengths: [1])
newSettings.IPv6Settings!.includedRoutes = [NEIPv6Route.defaultRoute()]
newSettings.MTU = 1432
self.reasserting = false
self.setTunnelNetworkSettings(newSettings) { (error: NSError?) -> Void in
...I want all the ipV4 and ipV6 packets to go to the TUN and that I would be able to read them
I dont know if the addresses and masks in the above code are as they supposed to be.
Thanks!