Feat/split tunneling - #244
Open
eYey343 wants to merge 2 commits into
Open
Conversation
The netbird bump added onStateChanged, which every implementation must carry. EngineRunner forwards it, EngineRestarter filters it during a restart like the other disconnect events, MainActivity ignores it.
Adds a split tunnelling screen with three modes: off, exclude the picked apps, or include only them. The two selections are stored apart, since Android's builder takes an allow list or a deny list but never both. A change forces a TUN rebuild, so it applies without reconnecting.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
eYey343
marked this pull request as ready for review
August 20, 2026 18:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let the user choose which apps the tunnel carries
What
Adds a split tunnelling screen under Settings, letting the user decide which
applications the tunnel carries. Three modes:
Until now
IFace.createTunkept four applications out of the tunnel with no wayfor the user to add their own. Those four remain the floor of Exclude, so
turning split tunnelling on never silently pulls them back in.
How
Android's
VpnService.Buildertakes an allow list or a deny list, never both onthe same builder, so the two selections are stored apart and a mode says which
one is live.
SplitTunnelConfigholds that decision — plain Java, no Androidtypes, so the rules are covered by JVM unit tests.
A change to the selection leaves routes and search domains untouched, which the
existing
recreateTUNguard reads as "nothing to do". The renewal request nowcarries a force flag so the rebuild that applies the new filter actually runs,
and the change takes hold without asking the user to reconnect.
Two rules are worth calling out:
carries nothing and reads as broken rather than configured. It falls back to
carrying everything, and the screen says so.
through
protectSocket, but the built-in SSH client has to reach peersthrough it.
The app list resolves the launcher intent rather than asking for
QUERY_ALL_PACKAGES, which Play treats as a sensitive permission. The trade-offis that applications without a launcher entry are not listed.
Tests
SplitTunnelConfigUnitTest— 11 JVM tests covering mode resolution, the emptyallowlist fallback, self-inclusion, and defensive copying of the stored sets.
PreferencesInstrumentedTest— 4 new cases for persistence, including keepingthe inactive selection across a mode change.
Verified by hand on an API 30 emulator with the tunnel up, watching the filter
follow the mode (
disallow 4→disallow 5→allow 2) and the tunnel rebuildon every change without a reconnection.
Screenshots
Note for reviewers
The branch also carries
Implement the ConnectionListener state callback, keptas a separate commit. The netbird bump in
1b7f067addedOnStateChangedto theinterface without the Java side following, which leaves the branch unable to
compile. Drop that commit if it lands upstream first.