Hello,
We are working on developing an iOS client that implements a custom VPN protocol using the PacketTunnelProvider from the NetworkExtension APIs. This client application is responsible for tunneling the traffic based on IP and host names. Hostname based applications are behind a private network and are not accessible from public internet. So, in order for us to tunnel the traffic based on host names, we are in a position to resolve the IP addresses locally on the client side, before tunneling the traffic. Please note that there are no custom / private DNS servers that can help us to resolve the IPs.
So essentially, we might have to resolve the DNS queries locally on the client for these specific set hostnames and then establish a connection to the remote endpoint in order to tunnel the traffic. We are kind of lost in weeds trying to identify a better solution to attain this functionality. Below is the approach that we are looking to give a try and would appreciate your inputs on what would be the best way to go about this.
Given that, we are establishing a tun interface on the PacketTunnelProvider to tunnel the traffic to the remote endpoint, one option is to make use of the existing tun interface to filter out the DNS packets and resolve the host names programmatically. This seems to be a viable solution but we are not sure about any potential implications in terms of performance bottlenecks related to DNS responses, caching etc. Also, concerned about App store limitations in using the tun interface to handle DNS packets.
Based on our research, AdBlock for iOS (https://adblockforios.com) also uses a VPN extension to resolve and blackhole the domain name based on the hosts list. So this is more in line with what we trying to achieve except for the fact that we would need to resolve the hostname rather than black holing it. This approach seems promising but would like to get feedback on this before we go down this road. Any thoughts or directions on this would be very helpful. Thanks in advance!