0

Is there a way to implement domain-based split tunneling in Android without parsing DNS queries? Hey fellow Android devs,

I'm working on implementing domain-based split tunneling in an Android VPN application and facing some challenges. While app-based split tunneling is straightforward using the VpnService API's allowedApplications list, domain-based filtering seems more complex.

Currently, the only approach I can see is:

Intercept DNS queries Parse the domain name from each query Track the resolved IPs for targeted domains Configure routing rules based on those IPs This feels inefficient and has limitations (shared hosting IPs, changing DNS records, etc.).

I know Windows has more native support for domain-based routing, and I'm wondering if there's a better approach on Android that I'm missing. Has anyone successfully implemented domain-based split tunneling without DNS interception? Maybe using undocumented APIs or creative workarounds?

Any insights, sample code, or even confirmation that DNS parsing is indeed the only way would be greatly appreciated. Thanks!

Edit: For context, I'm looking for a more efficient solution than what's commonly used. I understand the VpnService fundamentals but am hoping someone has discovered an alternative approach I haven't considered yet.

My question: Is there any way to implement domain-based split tunneling in Android without having to parse DNS queries and track IP mappings? Perhaps through some system API I'm missing or an alternative approach? I know Windows provides more direct mechanisms for domain-based routing. Does Android have any equivalent functionality that isn't well documented? Technical constraints:

Android 8.0+ support Need to handle both HTTP and HTTPS traffic Prefer a solution with lower battery/performance impact than DNS parsing

I've reviewed the VpnService documentation thoroughly but haven't found alternatives to the DNS parsing approach.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.