Is it possible not to use per-app VPN if need to determine only IP?
Sure. Parse the IP packet.
The global idea of all of this matter is not to send to VPN all of
traffic.
This is where things get tricky. While you can determine the destination IP address by parsing the packet, once the packet has made it to your packet tunnel provider then you are committed to sending it over the tunnel. There’s no way your provider can look at the packet and say “Oh, I don’t want to handle this, send via the normal mechanism.”
Rather, you must configure your tunnel’s network settings such that your only get the packets you’re prepared to handle. You do this using NEPacketTunnelNetworkSettings
, and specifically the includedRoutes
and excludedRoutes
properties of the NEIPv4Settings
and NEIPv6Settings
.
My experience is that most folks who run into problems like this do so because they’re not building a VPN. Rather, they’re trying to use a packet tunnel provider to build some other type of product, like a content filter. We don’t support that, per TN3120 Expected use cases for Network Extension packet tunnel providers.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"