Hi,
This is how we create ipv4Settings, then we add includedRoutes, excludedRoutes.
let ipv4Settings = NEIPv4Settings(addresses: addresses, subnetMasks: subnetMask)
In my case, Packet Tunnel Provider reads the packet like this - packetFlow.readPacketObjects, sends packets to C++ module which takes care of sending it to wireguard tunnel, returns packet back to Packet Tunnel Provider for writing. C++ Module does everything related to wireguard tunnel.
As per my understanding, any unique private ipv4, ipv6 address should be fine for creating NEIPv4Settings, NEIPv6Settings. is that correct? or is there anything else i need to consider for setting Utun addresses
as of now i have harcoded it to 10.10.10.10/32 and 2001:db8::/128, will it cause any problem?
The one thing you have to be careful of is conflicts. The addresses you pass in here will be assigned to the VPN interface. If some other interface on the system happens to use the same address, things won’t work properly. If you use a private address, you can’t guarantee that won’t happen.
I’ve actually seen this happen with VPNs that use a 10.0.0.0/8 address, assuming that the user’s Wi-Fi will use something from 192.168.0.0/16, and then fail when the user is on a network run by an AirPort base station, which just happens to use a 10.0.0.0/8 address.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"