Skip to content

Add Windows split tunneling - #151

Closed
ramimbo wants to merge 1 commit into
MathNodes:2.0-Windowsfrom
ramimbo:fix/windows-split-tunneling
Closed

Add Windows split tunneling#151
ramimbo wants to merge 1 commit into
MathNodes:2.0-Windowsfrom
ramimbo:fix/windows-split-tunneling

Conversation

@ramimbo

@ramimbo ramimbo commented May 22, 2026

Copy link
Copy Markdown

Closes #114

Summary

  • add Windows settings for enabling split tunneling and selecting bypass apps
  • capture the physical default route before tunnel startup, then add per-destination host routes for selected app processes
  • apply the routing worker for both WireGuard and V2Ray connections and remove saved routes on disconnect

Tests

  • PYTHONPATH=src python3 -m pytest -q
  • python3 -m compileall -q src/cli src/conf src/helpers src/ui src/adapters src/typedef
  • git diff --check HEAD~1 HEAD

@freQniK

freQniK commented May 28, 2026

Copy link
Copy Markdown
Collaborator

will review within the next week

@freQniK

freQniK commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

a dev reviewed this for me and said initially there was issues. He mentioned he would create a PR with the fixes. I'll consider both for the bounty. Note: the bounty of 1 XMR is for both MacOS and WIndows. If, this proves to work on WIndows the bounty would be .5 XMR split lopsided in your favor so long as the fixes weren't substantial.

@jimfund jimfund left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the routing mechanism in this PR. It does not provide per-application split tunneling as #114 specifies:

  • collect_destinations() observes remote IPs used by selected processes only after those connections already exist.
  • apply_routes() then installs ordinary /32 host routes for those destination IPs through the physical gateway.
  • A Windows route is selected by destination prefix/interface/gateway, not by originating process. Once installed, the route applies system-wide: every application connecting to the same IP bypasses the VPN, not just the selected app. The relevant command semantics are documented here: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008

This also means the selected app's first connection has already used the VPN before its destination can be discovered, while long-lived existing connections are not migrated. Shared CDN endpoints, DNS changes, and IP churn make the bypass incomplete and can leak unrelated applications outside the tunnel. The direct route add/route delete calls also need elevation; unlike other Windows paths in this project, these calls do not use gsudo, and failures are only reflected as an empty added result.

The proposed tests mock process connections and command execution, so they verify command construction but cannot establish per-process isolation. I syntax-checked the Python; I did not claim live Windows validation.

I would not merge this as per-app exclusion. A suitable design needs an enforcement primitive that can match the application identity before the first packet and steer/block it without creating destination routes shared by every process.

Disclosure: this review was produced by an AI coding agent operating for jimfund and independently checked against the patch and Microsoft documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants