[PR #3383] feat(windows): support live domain and wildcard site rules #3271

Open
opened 2026-11-07 17:58:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3383
Author: @makkoar
Created: 11/2/2026
Status: 🔄 Open

Base: dev ← Head: feature/dynamic-domain-split-tunneling


📝 Commits (3)

  • 9cf1c83 fix: preserve site CIDRs and refresh domain routes
  • da5e086 docs: restore upstream split tunneling comments
  • 8b7ac17 feat(windows): support live domain and wildcard site rules

📊 Changes

41 files changed (+2825 additions, -80 deletions)

View changed files

📝 client/cmake/sources.cmake (+4 -0)
📝 client/core/controllers/ipSplitTunnelingController.cpp (+160 -49)
📝 client/core/controllers/ipSplitTunnelingController.h (+18 -5)
➕ client/core/protocols/domainRoutingProtocol.cpp (+453 -0)
➕ client/core/protocols/domainRoutingProtocol.h (+47 -0)
📝 client/core/protocols/vpnProtocol.cpp (+8 -0)
📝 client/core/repositories/secureAppSettingsRepository.cpp (+54 -4)
📝 client/core/repositories/secureAppSettingsRepository.h (+12 -0)
📝 client/core/utils/constants/configKeys.h (+2 -0)
➕ client/core/utils/domainRouting.cpp (+332 -0)
➕ client/core/utils/domainRouting.h (+58 -0)
📝 client/core/utils/errorCodes.h (+3 -0)
📝 client/core/utils/errorStrings.cpp (+12 -0)
📝 client/daemon/daemon.cpp (+10 -1)
📝 client/daemon/interfaceconfig.cpp (+1 -0)
📝 client/daemon/interfaceconfig.h (+1 -0)
📝 client/mozilla/localsocketcontroller.cpp (+1 -0)
📝 client/platforms/windows/daemon/windowsdaemon.cpp (+6 -0)
📝 client/platforms/windows/daemon/windowsfirewall.cpp (+2 -2)
📝 client/platforms/windows/daemon/windowsfirewall.h (+5 -1)

...and 21 more files

📄 Description

Why

I want a domain in the site list to keep following its routing policy when its addresses change during a VPN session. I also need *.example.com to cover newly encountered subdomains without resolving a wildcard as though it were a hostname.

Refreshing IP routes alone cannot distinguish unrelated domains sharing an address. This adds an opt-in domain-aware path for Windows WireGuard/AmneziaWG connections.

Changes

  • Preserve exact domains, wildcard identities and literal IP/CIDR entries, including import/export. *.example.com matches nested subdomains, but not the apex or lookalike suffixes.
  • Use the bundled Xray core locally for TUN, DNS/FakeDNS and connection routing. The remote VPN remains native WireGuard/AmneziaWG; no Xray server or Xray key is required. Native credentials, peer AllowedIPs and MTU remain unchanged.
  • Bind direct and tunneled outgoing connections to their respective interfaces and source addresses. Keep the VPN-server exemption outside the domain-routing adapter.
  • Apply both site-list modes and all three application modes. Match HTTP Host/TLS SNI where available and preserve hosts mappings.
  • Use the configured DNS paths, respect answer lifetime, and avoid falling back from a selected domain's resolver group to the opposite path after a DNS failure.
  • Add exclusive ownership and a renewable lease for the local engine, so it cannot replace an active local proxy and stops if its owner disappears.
  • Keep the feature disabled by default and show its limitations before use. Existing literal-only routing stays on the native path.

Scope and limitations

  • Windows with WireGuard/AmneziaWG only. Unsupported combinations fail explicitly rather than silently ignoring a wildcard.
  • The new path handles IPv4 TCP/UDP. It blocks intercepted IPv6 destinations; remote ICMP/ping is not supported by this backend.
  • Application rules match executable paths, without automatic child-process inheritance. DNS resolver selection follows the site policy, not individual applications.
  • Browser Secure DNS/DoH settings are not changed. There is no HTTPS decryption or ECH suppression. An encrypted-DNS connection whose hostname is also hidden cannot reliably be matched by domain.
  • More-specific existing LAN routes retain OS priority. Changes to rules/settings take effect on reconnect; DNS-address changes do not require reconnecting.
  • Explicit IPv4 interface addresses and DNS servers are required. A physical interface using a loopback DNS stub is rejected; the local proxy and this mode cannot run concurrently.

Verification

  • Rebased onto release 5.1.0.6 (ac175c8a), still stacked on #3380. git range-diff confirms unchanged patch commits.
  • Clean Windows CMake configuration; combined Release client, privileged service and installer built with Qt 6.10.1 / MSVC 19.53.
  • Five isolated suites passed in the refreshed combined build with #3379 and #3030: domain routing, engine ownership, Windows route monitoring, settings QML and LocalSocketController route serialization. These are combined-build results, not separate full builds of each sibling PR.
  • The first combined CTest run failed in DomainRoutingTest without per-case QTest output. The same binary then passed all 44 checks in a diagnostic standalone run, and the full five-suite rerun passed with per-case reports enabled. The initial failure has not been explained; it is not being treated as a proven fix or hidden by the successful reruns.
  • The actual bundled amnezia-xray-bindings 1.5.0 was exercised on loopback, including 12 combinations of site mode, application mode and listed/unlisted process. Coverage includes shared-IP separation, wildcard boundaries, HTTP Host/TLS SNI, TCP/UDP, DNS A-to-B changes after TTL expiry, FakeDNS, CNAME, multiple A answers, hosts, CIDRs and DNS failure.
  • Production engine ownership/lease tests and a regression test for overlay creation, recreation and physical-route loss passed. The route test substitutes Windows route APIs and does not modify the host routing table.
  • The actual settings QML page loads in an offscreen engine; toggle binding and literal wildcard search are checked.

Still requiring on-device acceptance: real TUN activation together with a remote WG/AWG session, WFP/kill-switch behavior, network transitions and adapter/DNS cleanup after disconnect or failure. The isolated core tests and successful build are not presented as proof of those native integration scenarios. The installed VPN was not stopped or replaced during these checks.

Closes #3381.

This PR is stacked on #3380, which provides the site storage/normalization and reconnect-time refresh changes. Its two prerequisite commits are currently included in the comparison against dev; they can be removed from the comparison once #3380 lands.

Related: #1217, #1423 and the tracker #3378. #3379 and #3030 remain separate bug-fix PRs; they were combined locally into an installer prepared for on-device acceptance, not folded into this feature branch.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/3383 **Author:** [@makkoar](https://github.com/makkoar) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `feature/dynamic-domain-split-tunneling` --- ### 📝 Commits (3) - [`9cf1c83`](https://github.com/amnezia-vpn/amnezia-client/commit/9cf1c8348c93a2fd06eab322ff3ba52562c18d1c) fix: preserve site CIDRs and refresh domain routes - [`da5e086`](https://github.com/amnezia-vpn/amnezia-client/commit/da5e08667f9632c0fdaae99ef7a8bfc61eb995d2) docs: restore upstream split tunneling comments - [`8b7ac17`](https://github.com/amnezia-vpn/amnezia-client/commit/8b7ac179191fbc282664557bcf0b4fc89ea53b51) feat(windows): support live domain and wildcard site rules ### 📊 Changes **41 files changed** (+2825 additions, -80 deletions) <details> <summary>View changed files</summary> 📝 `client/cmake/sources.cmake` (+4 -0) 📝 `client/core/controllers/ipSplitTunnelingController.cpp` (+160 -49) 📝 `client/core/controllers/ipSplitTunnelingController.h` (+18 -5) ➕ `client/core/protocols/domainRoutingProtocol.cpp` (+453 -0) ➕ `client/core/protocols/domainRoutingProtocol.h` (+47 -0) 📝 `client/core/protocols/vpnProtocol.cpp` (+8 -0) 📝 `client/core/repositories/secureAppSettingsRepository.cpp` (+54 -4) 📝 `client/core/repositories/secureAppSettingsRepository.h` (+12 -0) 📝 `client/core/utils/constants/configKeys.h` (+2 -0) ➕ `client/core/utils/domainRouting.cpp` (+332 -0) ➕ `client/core/utils/domainRouting.h` (+58 -0) 📝 `client/core/utils/errorCodes.h` (+3 -0) 📝 `client/core/utils/errorStrings.cpp` (+12 -0) 📝 `client/daemon/daemon.cpp` (+10 -1) 📝 `client/daemon/interfaceconfig.cpp` (+1 -0) 📝 `client/daemon/interfaceconfig.h` (+1 -0) 📝 `client/mozilla/localsocketcontroller.cpp` (+1 -0) 📝 `client/platforms/windows/daemon/windowsdaemon.cpp` (+6 -0) 📝 `client/platforms/windows/daemon/windowsfirewall.cpp` (+2 -2) 📝 `client/platforms/windows/daemon/windowsfirewall.h` (+5 -1) _...and 21 more files_ </details> ### 📄 Description ## Why I want a domain in the site list to keep following its routing policy when its addresses change during a VPN session. I also need `*.example.com` to cover newly encountered subdomains without resolving a wildcard as though it were a hostname. Refreshing IP routes alone cannot distinguish unrelated domains sharing an address. This adds an opt-in domain-aware path for Windows WireGuard/AmneziaWG connections. ## Changes - Preserve exact domains, wildcard identities and literal IP/CIDR entries, including import/export. `*.example.com` matches nested subdomains, but not the apex or lookalike suffixes. - Use the bundled Xray core locally for TUN, DNS/FakeDNS and connection routing. **The remote VPN remains native WireGuard/AmneziaWG; no Xray server or Xray key is required.** Native credentials, peer AllowedIPs and MTU remain unchanged. - Bind direct and tunneled outgoing connections to their respective interfaces and source addresses. Keep the VPN-server exemption outside the domain-routing adapter. - Apply both site-list modes and all three application modes. Match HTTP Host/TLS SNI where available and preserve hosts mappings. - Use the configured DNS paths, respect answer lifetime, and avoid falling back from a selected domain's resolver group to the opposite path after a DNS failure. - Add exclusive ownership and a renewable lease for the local engine, so it cannot replace an active local proxy and stops if its owner disappears. - Keep the feature disabled by default and show its limitations before use. Existing literal-only routing stays on the native path. ## Scope and limitations - Windows with WireGuard/AmneziaWG only. Unsupported combinations fail explicitly rather than silently ignoring a wildcard. - The new path handles IPv4 TCP/UDP. It blocks intercepted IPv6 destinations; remote ICMP/ping is not supported by this backend. - Application rules match executable paths, without automatic child-process inheritance. DNS resolver selection follows the site policy, not individual applications. - Browser Secure DNS/DoH settings are not changed. There is no HTTPS decryption or ECH suppression. An encrypted-DNS connection whose hostname is also hidden cannot reliably be matched by domain. - More-specific existing LAN routes retain OS priority. Changes to rules/settings take effect on reconnect; DNS-address changes do not require reconnecting. - Explicit IPv4 interface addresses and DNS servers are required. A physical interface using a loopback DNS stub is rejected; the local proxy and this mode cannot run concurrently. ## Verification - Rebased onto release `5.1.0.6` (`ac175c8a`), still stacked on #3380. `git range-diff` confirms unchanged patch commits. - Clean Windows CMake configuration; combined Release client, privileged service and installer built with Qt 6.10.1 / MSVC 19.53. - Five isolated suites passed in the refreshed combined build with #3379 and #3030: domain routing, engine ownership, Windows route monitoring, settings QML and LocalSocketController route serialization. These are combined-build results, not separate full builds of each sibling PR. - The first combined CTest run failed in DomainRoutingTest without per-case QTest output. The same binary then passed all 44 checks in a diagnostic standalone run, and the full five-suite rerun passed with per-case reports enabled. The initial failure has not been explained; it is not being treated as a proven fix or hidden by the successful reruns. - The actual bundled `amnezia-xray-bindings` 1.5.0 was exercised on loopback, including 12 combinations of site mode, application mode and listed/unlisted process. Coverage includes shared-IP separation, wildcard boundaries, HTTP Host/TLS SNI, TCP/UDP, DNS A-to-B changes after TTL expiry, FakeDNS, CNAME, multiple A answers, hosts, CIDRs and DNS failure. - Production engine ownership/lease tests and a regression test for overlay creation, recreation and physical-route loss passed. The route test substitutes Windows route APIs and does not modify the host routing table. - The actual settings QML page loads in an offscreen engine; toggle binding and literal wildcard search are checked. **Still requiring on-device acceptance:** real TUN activation together with a remote WG/AWG session, WFP/kill-switch behavior, network transitions and adapter/DNS cleanup after disconnect or failure. The isolated core tests and successful build are not presented as proof of those native integration scenarios. The installed VPN was not stopped or replaced during these checks. ## Related issues and overlapping PRs Closes #3381. This PR is stacked on #3380, which provides the site storage/normalization and reconnect-time refresh changes. Its two prerequisite commits are currently included in the comparison against `dev`; they can be removed from the comparison once #3380 lands. Related: #1217, #1423 and the tracker #3378. #3379 and #3030 remain separate bug-fix PRs; they were combined locally into an installer prepared for on-device acceptance, not folded into this feature branch. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3271
No description provided.