Bypass DNS queries differently in iOS

I know that I cannot install DNS servers for a long time programmatically on a non-jailbroken device, but I am looking for a way to route all DNS queries in my application to the specified DNS server (for example, Google DNS 4.2.2.1) to bypass the system DNS based censorship. I know that I can hardcode the specified IP addresses for hosts by setting the IP and host headers in NSURLRequest (I'm already doing this in another application), but I'm looking for a more general way to achieve this. Is there a way to redirect all DNS queries in my application? Will override NSURLConnection classes (I know this is a very bad practice,but it works great in my application) allows me to override the default behavior of URLs? Does this include accessing / overriding (if possible) private APIs and disconnecting my application from the App Store? What would be the best practice?

+4
source share
1 answer

If your application will work in an environment in which they can reach the desired IP address but cannot trust the DNS, then you can hardcode the application to use the target, and then add the “fault tolerant server” preloader, which you send if you plan move the IP address.

When moving, you must also release an update with new addresses in the new version.

This approach has many limitations ... and I think that larger assumptions about the network may not make sense (if they block DNS, it seems unlikely that you will have a good connection with IP addresses).

, , , iOS . .

0

Source: https://habr.com/ru/post/1532805/


All Articles