Skip to content

Add desktop proxy mode and Apple VPN configuration removal - #283

Merged
yiguodev merged 15 commits into
mainfrom
dev-26.11.5-2
Nov 16, 2026
Merged

yiguodev merged 15 commits into
mainfrom
dev-26.11.5-2

Conversation

@yiguodev

@yiguodev yiguodev commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Desktop users can choose local HTTP/SOCKS5 proxying alongside TUN, including a Windows path that runs without requesting UAC.

Desktop connection
├── TUN → existing VPN host
└── Local proxy
    ├── macOS / SE → shared signed helper
    └── Windows / Linux → owned Core process
  • Add mode selection, stable endpoints, save/reconnect behavior and device-local preferences. Windows/GNOME can manage current-user system proxy settings with ownership-aware rollback, recovery and explicit cleanup retries; macOS and other Linux desktops use manual endpoints.
  • Embed both macOS helpers with their own App IDs/profiles. Keep probes and validation in Runner using the existing libXray API.
  • Add confirmed VPN configuration removal on iOS/macOS and system-extension deactivation requests on macOS SE.
  • Keep proxy snapshots separate from saved TUN input, reject cross-mode VPN starts before network changes, and bound recovery journals before system proxy writes.
  • Distinguish favorite states, restore normal language selection on Linux ARM64, and consolidate tunnel settings with Restore Defaults at the end of the page.

Related: #280, #281, #282.

Evidence

  • Before: desktop connectivity required the TUN/VPN path, and Apple VPN configuration removal was unavailable in the App.
    After: flutter test passed with 2493 tests and 4 skips; static analysis, formatting, layer and native model checks passed.
  • Native helper/process/termination tests passed 11 cases, Apple VPN removal tests passed 8 cases, and native runtime/startup-input tests passed 16 cases. Complete macOS/SE Debug App and iOS simulator builds passed; both macOS bundle signatures were verified. Universal Release helper signing also passed.
  • Signed isolated Foundation harnesses ran the production helper in inherited sandboxes: real HTTP/SOCKS traffic continued during 160 parent configuration validations and a five-item batch probe; stop and channel EOF reaped the helper. These are helper runtime checks, not full App/UI acceptance.
  • Windows/Linux native system-proxy validation, a real saved-VPN restart from System Settings, and ordinary macOS Store-distribution runtime acceptance remain pending.

Merge Danger

Door: Two-way. Stop active proxy sessions before reverting so owned system proxy settings are restored.

Blast Radius: Connectivity.

Changes affect desktop Core lifecycle, per-user proxy settings, connection state, and confirmed Apple VPN/extension removal.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 01:58
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T03:56:26.840237Z d2d49da New commits
🔒 Security Review ✅ Completed 2026-11-16T03:57:59.968989Z d2d49da New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5082875fef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/core/proxy/host.dart Resolved

Copilot AI 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.

🟡 Changes recommended

Critical proxy lifecycle issues block cleanup retries after restore failures and allow macOS to terminate despite an unconfirmed stop.

3 open issues
1 file not reviewed
  • lib/core/pigeon/model.g.dart: Generated file
What changed in this PR

Adds local HTTP/SOCKS5 proxy mode alongside OneXray’s desktop VPN path, plus confirmed Apple VPN configuration removal and macOS system-extension deactivation for #280.

Changes:

  • Adds desktop mode selection, stable proxy endpoints, device-local preferences, and ownership-aware system-proxy recovery.
  • Integrates the macOS helper and Apple VPN removal with connection lifecycle, native bridges, and signing.
  • Updates connection UI, favorite indicators, Linux ARM64 language selection, tests, and documentation.
File Description
tool/​test_desktop_proxy_helper.sh Runs native helper protocol and process tests.
tool/​test_apple_vpn_removal.sh Runs native VPN removal tests.
tool/​check_native_model_contract.dart Checks new request fields across native models.
test/​service/​shared/​menu/​tray/​refresh_test.dart Tests proxy-aware tray labels.
test/​service/​shared/​menu/​tray/​quit_test.dart Tests proxy cleanup before quitting.
test/​service/​settings/​language/​locale_test.dart Tests platform-independent language selection.
test/​service/​launch/​setup_test.dart Tests proxy setup without interface requirements.
test/​service/​connect/​coordinator_test.dart Tests proxy status reconciliation and retained state.
test/​service/​advanced/​policy_editor_test.dart Tests confirmation and reconnect after stop failure.
test/​service/​advanced/​desktop_proxy_policy_test.dart Tests proxy policy and backup boundaries.
test/​pages/​servers/​restored_resource_actions_test.dart Checks favorite indicator states.
test/​pages/​launch/​setup_view_test.dart Tests desktop proxy setup presentation.
test/​pages/​launch/​setup_controller_test.dart Updates the setup service test double.
test/​pages/​connect/​view_test.dart Tests proxy endpoints and ownership display.
test/​pages/​advanced/​tunnel/​root_page_test.dart Tests proxy settings and removal sections.
test/​native/​SystemExtensionActivationTests.swift Tests delayed deactivation results.
test/​native/​ProxyHelperProtocolTests.swift Tests framing, timeouts, and closed channels.
test/​native/​ProxyHelperProcessTests.swift Tests helper startup, status, and shutdown.
test/​native/​AppleVpnRemovalTests.swift Tests removal ownership, serialization, and failures.
test/​core/​proxy/​system_proxy_test.dart Tests proxy settings and restoration comparisons.
test/​core/​proxy/​linux_process_identity_test.dart Tests Linux process identity safeguards.
test/​core/​proxy/​journal_test.dart Tests private recovery journal storage.
test/​core/​proxy/​core_session_test.dart Tests recovery after installation changes.
test/​core/​pigeon/​native_json_contract_test.dart Checks proxy request serialization fields.
test/​core/​ffi/​base_ffi_api_test.dart Tests proxy and TUN command arguments.
swift/​macOS/​SystemExtensionManager.swift Adds terminal-result deactivation handling.
swift/​macOS/​ProxyHelper/​ProxyHelperProtocol.swift Defines framed helper communication.
swift/​macOS/​ProxyHelper/​ProxyHelperProcess.swift Owns helper process and channel lifecycle.
swift/​macOS/​ProxyHelper/​ProxyHelperMain.swift Runs Core commands inside the helper.
swift/​macOS/​ProxyHelper/​ProxyHelper.entitlements Enables inherited sandboxing.
swift/​macOS/​ProxyHelper/​Info.plist Defines background helper bundle metadata.
swift/​macOS/​MainFlutterWindow.swift Registers the proxy bridge and status callback.
swift/​macOS/​DesktopProxyHost.swift Coordinates native proxy lifecycle and state.
swift/​macOS/​AppDelegate.swift Stops the proxy during app termination.
swift/​App/​pigeon/​Messages.g.swift Regenerates proxy and removal bridge APIs.
swift/​App/​pigeon/​HostApi.swift Exposes Apple VPN removal.
swift/​App/​pigeon/​FlutterApi.swift Forwards proxy-aware status notifications.
swift/​App/​AppleVpnRemoval.swift Serializes owned VPN profile removal.
swift/​All/​Model.swift Adds proxy fields to native start requests.
pigeon/​message.dart Defines proxy lifecycle and removal APIs.
macos/​fastlane/​Fastfile Adds ordinary macOS helper provisioning.
macos_se/​fastlane/​Fastfile Adds SE helper provisioning.
lib/​service/​shared/​menu/​tray/​service.dart Adapts tray actions and quitting for proxy mode.
lib/​service/​shared/​menu/​tray/​menu.dart Tracks capture policy and proxy routing labels.
lib/​service/​settings/​language/​locale.dart Removes the Linux ARM64 language fallback.
lib/​service/​settings/​backup/​platform_settings.dart Excludes device-local proxy preferences.
lib/​service/​manager.dart Performs proxy recovery during startup.
lib/​service/​launch/​setup.dart Saves desktop mode without requiring proxy interfaces.
lib/​service/​connect/​runtime.dart Preserves actual capture mode in runtime snapshots.
lib/​service/​connect/​runtime_host.dart Routes lifecycle calls to the selected backend.
lib/​service/​connect/​raw/​editor.dart Adds proxy-aware Raw compilation options.
lib/​service/​connect/​preparation.dart Prepares proxy ports, options, and requests.
lib/​service/​connect/​platform_requirements.dart Separates proxy and TUN prerequisites.
lib/​service/​connect/​coordinator.dart Reconciles proxy state and serializes maintenance.
lib/​service/​connect/​compiler.dart Compiles desktop proxy runtime graphs.
lib/​service/​advanced/​tunnel/​apple/​removal.dart Runs Apple removal through the connection queue.
lib/​service/​advanced/​policy_editor.dart Validates proxy settings and reconnect decisions.
lib/​service/​advanced/​platform_policy.dart Defines capture mode and proxy preferences.
lib/​service/​advanced/​local_api/​configuration.dart Accepts proxy-mode compilation previews.
lib/​pages/​theme/​theme.dart Centralizes favorite state styling.
lib/​pages/​shared/​widgets/​app_favorite.dart Adds shared favorite icons and buttons.
lib/​pages/​servers/​view.dart Uses shared favorite controls in server lists.
lib/​pages/​servers/​details.dart Displays favorite state in server details.
lib/​pages/​launch/​setup/​view.dart Adds desktop capture-mode selection.
lib/​pages/​launch/​setup/​page.dart Passes proxy capabilities into setup presentation.
lib/​pages/​launch/​setup/​controller.dart Loads and saves capture-mode choices.
lib/​pages/​connect/​view.dart Displays proxy status and copyable endpoints.
lib/​pages/​connect/​routing/​page.dart Uses proxy-aware routing labels.
lib/​pages/​connect/​routing/​controller.dart Resolves effective mode for routing presentation.
lib/​pages/​connect/​page.dart Supplies capture mode and endpoint preferences.
lib/​pages/​connect/​controller.dart Tracks proxy ownership and connection labels.
lib/​l10n/​app_zh.arb Adds Simplified Chinese proxy and removal text.
lib/​l10n/​app_zh_Hant.arb Adds Traditional Chinese proxy and removal text.
lib/​l10n/​app_ru.arb Adds Russian proxy and removal text.
lib/​l10n/​app_fa.arb Adds Persian proxy and removal text.
lib/​l10n/​app_en.arb Adds English proxy and removal text.
lib/​core/​proxy/​windows_proxy.dart Implements current-user Windows proxy settings.
lib/​core/​proxy/​system_proxy.dart Defines proxy adapters and ownership comparisons.
lib/​core/​proxy/​linux_process_identity.dart Verifies Linux process identity before recovery signals.
lib/​core/​proxy/​journal.dart Stores private, locked recovery records.
lib/​core/​pigeon/​model.g.dart Regenerates proxy request serialization.
lib/​core/​pigeon/​model.dart Adds and validates capture-mode request fields.
lib/​core/​pigeon/​messages.g.dart Regenerates Dart proxy and removal bridges.
lib/​core/​pigeon/​host_api.dart Adds platform-guarded Apple VPN removal.
lib/​core/​pigeon/​desktop_proxy_api.dart Wraps macOS helper bridge calls.
lib/​core/​ffi/​base_ffi_api.dart Supports proxy commands without DNS or interface arguments.
ios/​Runner.xcodeproj/​project.pbxproj Includes the shared VPN removal source.
docs/​xray-configuration.md Documents proxy runtime and recovery contracts.
docs/​validation.md Documents proxy and Apple removal verification.
docs/​external-interfaces.md Documents proxy compilation preview options.
docs/​app.md Updates desktop mode, removal, and UI contracts.
build_scripts/​README.md Documents helper packaging and signing.
android/​app/​src/​main/​kotlin/​net/​yuandev/​onexray/​pigeon/​Model.kt Adds compatible proxy request fields.
android/​app/​src/​main/​kotlin/​net/​yuandev/​onexray/​pigeon/​Messages.g.kt Regenerates Kotlin bridge contracts.
android/​app/​src/​main/​kotlin/​net/​yuandev/​onexray/​pigeon/​HostApi.kt Explicitly rejects Apple removal on Android.

Review effort: Balanced

Comment thread lib/service/connect/runtime_host.dart Resolved
Comment thread swift/macOS/AppDelegate.swift Resolved
Copilot AI balanced review requested due to automatic review settings November 16, 2026 02:46

Copilot AI 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.

🟡 Changes recommended

Critical defects can overwrite VPN startup input with proxy requests and produce unreadable recovery journals, risking broken connectivity and leaving applications pointed at a dead proxy after a crash.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve recovery state when a live process image cannot be verified

lib/​core/​proxy/​linux_process_identity.dart:38

An ENOENT from resolving /proc/$pid/exe does not necessarily mean the process exited: replacing or deleting a running executable leaves the process alive, but canonicalizing its /proc link fails with ENOENT. Returning null here makes ProcessProxyCoreSession.recover() skip the live Core and lets the host clear its recovery journal, leaving an unowned listener that blocks subsequent connections. Recheck the process metadata before treating this error as an exited PID; if it is still alive, retain recovery state and report that its image cannot be verified.

3 resolved since last review
1 file not reviewed
  • lib/core/pigeon/model.g.dart: Generated file

Review effort: Balanced

Comment thread lib/core/proxy/journal.dart Resolved
Comment thread swift/macOS/DesktopProxyHost.swift Resolved
Copilot AI balanced review requested due to automatic review settings November 16, 2026 03:52

Copilot AI 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.

🟡 Changes recommended

The validation documentation overstates test coverage, presenting listener and command checks as evidence of real HTTP/SOCKS forwarding and helper cleanup on parent-channel EOF.

1 open issue
2 resolved since last review
1 file not reviewed
  • lib/core/pigeon/model.g.dart: Generated file

Review effort: Balanced

Comment thread docs/validation.md Resolved
Copilot AI balanced review requested due to automatic review settings November 16, 2026 04:23

Copilot AI 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.

🔵 Needs a closer look

Platform-owner acceptance remains pending for connectivity-critical Windows/GNOME proxy writes and recovery, saved Apple VPN restart from System Settings, and macOS Store-distribution runtime behavior.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • lib/core/pigeon/model.g.dart: Generated file

Review effort: Balanced

@yiguodev
yiguodev merged commit ce7fbcc into main Nov 16, 2026
2 checks passed
@yiguodev
yiguodev deleted the dev-26.11.5-2 branch November 16, 2026 05:46
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.

2 participants