feat(app): release 3.3.1 with secure routing and runtime resilience #2

Merged
Naveax merged 6 commits from release/3.3.1 into main 2026-08-31 23:30:43 +03:00
Naveax commented 2026-08-31 20:45:11 +03:00 (Migrated from github.com)

Summary

This prepares the 3.3.1 client release directly on top of the current 3.3.0 main branch.

The branch was rebuilt from upstream main instead of carrying the fork's development history. It keeps the hosted flutter_vless_android 1.1.5 runtime as the stable base and adds explicit TUN/SOCKS5 routing, authenticated per-session Local SOCKS5, per-app routing, Android network resilience, lifecycle/session reconciliation, notification hardening, haptic cleanup and regression coverage.

1. Connection modes

  • Remove Auto from the public connection-mode model and settings UI.
  • Keep only TUN and SOCKS5 as explicit choices.
  • Migrate stored legacy auto values to TUN.
  • Migrate stored legacy ass values to SOCKS5 without dropping the saved app package list.
  • Default new/unknown mode state to TUN.

2. App routing

Add Android app routing with three policies:

  • All apps: route all eligible app traffic through the VPN.
  • Exclude apps: route everything except the selected package list.
  • Selected only: route only the selected package list.

The app picker enumerates launcher applications and does not request QUERY_ALL_PACKAGES.

3. Secure Local SOCKS5

Replace the old fixed-port/no-auth local path with an authenticated per-session ingress:

  • Listen on 127.0.0.1 only.
  • Pick a random high port for every VPN session.
  • Generate a fresh random username and password for every session.
  • Keep generated credentials in memory only.
  • Do not persist or log generated credentials.
  • Remove legacy unauthenticated SOCKS/HTTP proxy inbounds while preparing the runtime config.
  • Authenticate the SOCKS readiness probe against the exact active session.
  • Hide the Local SOCKS test in TUN mode.
  • In SOCKS5 mode, test the active random port and credentials instead of fixed 10807/10808 ports.

4. Stock Xray / flutter_vless runtime

Keep the hosted flutter_vless_android 1.1.5 package as the runtime base.

This PR intentionally does not restore the experimental vendored third_party/flutter_vless_android service used during development because that path introduced VPN self-stop/lifecycle regressions.

Instead, Android build tasks apply idempotent patches to the pinned stock package for:

  • per-app allowed/blocked routing support;
  • authenticated Local SOCKS5 parameters;
  • Xray/tun2socks readiness and recovery handling;
  • bounded FD handoff/recovery behavior;
  • secure runtime monitor scope;
  • foreground notification ongoing/no-clear flags.

The patchers run automatically before Android/plugin compilation and are checked for idempotence.

5. Network resilience

Add Standard and Extreme resilience profiles.

Android ConnectivityManager events are exposed to Flutter for physical-network state/transport reporting. VPN-created network callbacks are informational rather than blindly restarting the runtime, avoiding reconnect loops caused by observing the VPN's own network.

Extreme mode can perform bounded runtime recovery when the active runtime unexpectedly disconnects and a valid config snapshot still exists.

6. Session timer and Android lifecycle

Preserve the existing 3.3.0 polling policy:

  • 5 second server polling while foregrounded;
  • 30 second polling while backgrounded.

Add lifecycle reconciliation around it:

  • Track the last server-confirmed remaining time.
  • Recalculate displayed remaining time from elapsed wall-clock time when Dart timers are throttled/suspended.
  • Trigger an immediate Hivemind sync on app resume.
  • Resume ticking without depending on every background one-second callback having executed.
  • Treat an already reachable native VPN as healthy while session sync catches up, reducing false Syncing… presentation after resume.

No permanent wake lock is added; the Android VPN remains a foreground VpnService and the Flutter UI reconciles its state when resumed.

7. Notifications

  • Add a dedicated 24 dp monochrome VPN status icon.
  • Keep the VPN foreground notification ongoing/no-clear while the service is active.
  • Preserve normal notification removal when the VPN is explicitly disconnected/stopped.
  • Preserve the existing countdown and Disconnect behavior from 3.3.0.
  • Mark session time/speed metadata as private for lock-screen previews.

Android 14+ can still allow user dismissal of some ongoing foreground-service notifications while unlocked; the app sets the supported ongoing/no-clear flags without creating a duplicate notification.

8. Haptic feedback

  • Add a persistent HapticSettings manager initialized at startup.
  • Route Android vibration through a native method channel.
  • Add a global app haptic surface for normal taps.
  • Remove duplicate manual feedback from the haptic toggle.
  • Serialize toggle persistence so rapid writes do not race.

9. Hivemind client cleanup

Refactor client-side session/config handling into smaller typed responsibilities:

  • use Random.secure() for nonce generation;
  • validate required session fields and VLESS port range before constructing the connection URL;
  • avoid logging nonce values;
  • keep cancellation/attempt handling explicit.

Existing AdMob bypass/callback behavior is intentionally unchanged by this PR.

10. Updater and startup integration

  • Preserve the 3.3.0 startup behavior where VpnConnection.ready completes before leaving the intro screen, with the existing timeout cap.
  • Initialize the persistent haptic manager during startup.
  • Keep sidebar updater navigation safe after the drawer closes by using captured navigator/messenger handles.
  • Retain the existing updater URL validation/hardening.

11. Build reliability

Increase Gradle release-build heap from 1536 MiB to 4 GiB and cap Gradle workers at two.

The previous value caused Jetifier to fail while transforming Flutter's release classpath with java.lang.OutOfMemoryError: Java heap space during clean CI builds.

12. Regression tests

Add coverage for:

  • legacy Auto -> TUN migration;
  • legacy ASS -> SOCKS5 selected-only migration while preserving packages;
  • per-session authenticated SOCKS config generation;
  • stock-runtime patch validation for Xray's current users[{user, pass}] SOCKS schema.

13. Version and changelog

  • Bump app version from 3.3.0+26 to 3.3.1+27.
  • Add a 3.3.1 CHANGELOG.md section covering routing, SOCKS5, runtime resilience, lifecycle, notification, privacy and validation changes.

14. Validation

Validation was run from a clean staging branch based on the same upstream 3.3.0 main SHA. The product code matches this release branch; the staging-only workflow is not included in the PR, and the changelog is a docs-only commit added after validation.

  • Release invariants: passed
  • Native patcher analysis: passed
  • Native patch application: passed
  • Native patch idempotence: passed
  • flutter analyze --no-fatal-warnings --no-fatal-infos: passed
  • Flutter regression tests: 4/4 passed
  • Android release Kotlin compilation: passed
  • 3.3.1 APK build: passed
  • Packaged VPN runtime verification: passed

Validation run: https://github.com/Naveax/ReVoltVPN/actions/runs/33419744747

15. Scope intentionally not changed

  • No vendored third_party/flutter_vless_android runtime is added.
  • No temporary diagnostic/build workflow is included in this PR.
  • No server-side Hivemind deployment files are changed.
  • No nginx configuration is changed.
  • No Reality server configuration is changed.
  • No productionization/re-enabling of the current AdMob bypass path is included.

Commit structure

The branch contains six reviewable commits following CONTRIBUTING.md:

  1. feat(app): add secure routing and runtime resilience
  2. test(app): cover routing and secure socks migrations
  3. build(config): bump app version to 3.3.1
  4. build(config): increase gradle heap for release builds
  5. fix(app): hide session metadata on lock screen
  6. docs: document 3.3.1 release changes
## Summary This prepares the **3.3.1** client release directly on top of the current **3.3.0 `main`** branch. The branch was rebuilt from upstream `main` instead of carrying the fork's development history. It keeps the hosted `flutter_vless_android 1.1.5` runtime as the stable base and adds explicit TUN/SOCKS5 routing, authenticated per-session Local SOCKS5, per-app routing, Android network resilience, lifecycle/session reconciliation, notification hardening, haptic cleanup and regression coverage. ## 1. Connection modes - Remove Auto from the public connection-mode model and settings UI. - Keep only **TUN** and **SOCKS5** as explicit choices. - Migrate stored legacy `auto` values to TUN. - Migrate stored legacy `ass` values to SOCKS5 without dropping the saved app package list. - Default new/unknown mode state to TUN. ## 2. App routing Add Android app routing with three policies: - **All apps**: route all eligible app traffic through the VPN. - **Exclude apps**: route everything except the selected package list. - **Selected only**: route only the selected package list. The app picker enumerates launcher applications and does **not** request `QUERY_ALL_PACKAGES`. ## 3. Secure Local SOCKS5 Replace the old fixed-port/no-auth local path with an authenticated per-session ingress: - Listen on `127.0.0.1` only. - Pick a random high port for every VPN session. - Generate a fresh random username and password for every session. - Keep generated credentials in memory only. - Do not persist or log generated credentials. - Remove legacy unauthenticated SOCKS/HTTP proxy inbounds while preparing the runtime config. - Authenticate the SOCKS readiness probe against the exact active session. - Hide the Local SOCKS test in TUN mode. - In SOCKS5 mode, test the active random port and credentials instead of fixed `10807`/`10808` ports. ## 4. Stock Xray / flutter_vless runtime Keep the hosted `flutter_vless_android 1.1.5` package as the runtime base. This PR intentionally does **not** restore the experimental vendored `third_party/flutter_vless_android` service used during development because that path introduced VPN self-stop/lifecycle regressions. Instead, Android build tasks apply idempotent patches to the pinned stock package for: - per-app allowed/blocked routing support; - authenticated Local SOCKS5 parameters; - Xray/tun2socks readiness and recovery handling; - bounded FD handoff/recovery behavior; - secure runtime monitor scope; - foreground notification ongoing/no-clear flags. The patchers run automatically before Android/plugin compilation and are checked for idempotence. ## 5. Network resilience Add **Standard** and **Extreme** resilience profiles. Android `ConnectivityManager` events are exposed to Flutter for physical-network state/transport reporting. VPN-created network callbacks are informational rather than blindly restarting the runtime, avoiding reconnect loops caused by observing the VPN's own network. Extreme mode can perform bounded runtime recovery when the active runtime unexpectedly disconnects and a valid config snapshot still exists. ## 6. Session timer and Android lifecycle Preserve the existing 3.3.0 polling policy: - 5 second server polling while foregrounded; - 30 second polling while backgrounded. Add lifecycle reconciliation around it: - Track the last server-confirmed remaining time. - Recalculate displayed remaining time from elapsed wall-clock time when Dart timers are throttled/suspended. - Trigger an immediate Hivemind sync on app resume. - Resume ticking without depending on every background one-second callback having executed. - Treat an already reachable native VPN as healthy while session sync catches up, reducing false `Syncing…` presentation after resume. No permanent wake lock is added; the Android VPN remains a foreground `VpnService` and the Flutter UI reconciles its state when resumed. ## 7. Notifications - Add a dedicated 24 dp monochrome VPN status icon. - Keep the VPN foreground notification ongoing/no-clear while the service is active. - Preserve normal notification removal when the VPN is explicitly disconnected/stopped. - Preserve the existing countdown and Disconnect behavior from 3.3.0. - Mark session time/speed metadata as private for lock-screen previews. Android 14+ can still allow user dismissal of some ongoing foreground-service notifications while unlocked; the app sets the supported ongoing/no-clear flags without creating a duplicate notification. ## 8. Haptic feedback - Add a persistent `HapticSettings` manager initialized at startup. - Route Android vibration through a native method channel. - Add a global app haptic surface for normal taps. - Remove duplicate manual feedback from the haptic toggle. - Serialize toggle persistence so rapid writes do not race. ## 9. Hivemind client cleanup Refactor client-side session/config handling into smaller typed responsibilities: - use `Random.secure()` for nonce generation; - validate required session fields and VLESS port range before constructing the connection URL; - avoid logging nonce values; - keep cancellation/attempt handling explicit. **Existing AdMob bypass/callback behavior is intentionally unchanged by this PR.** ## 10. Updater and startup integration - Preserve the 3.3.0 startup behavior where `VpnConnection.ready` completes before leaving the intro screen, with the existing timeout cap. - Initialize the persistent haptic manager during startup. - Keep sidebar updater navigation safe after the drawer closes by using captured navigator/messenger handles. - Retain the existing updater URL validation/hardening. ## 11. Build reliability Increase Gradle release-build heap from 1536 MiB to 4 GiB and cap Gradle workers at two. The previous value caused Jetifier to fail while transforming Flutter's release classpath with `java.lang.OutOfMemoryError: Java heap space` during clean CI builds. ## 12. Regression tests Add coverage for: - legacy Auto -> TUN migration; - legacy ASS -> SOCKS5 selected-only migration while preserving packages; - per-session authenticated SOCKS config generation; - stock-runtime patch validation for Xray's current `users[{user, pass}]` SOCKS schema. ## 13. Version and changelog - Bump app version from `3.3.0+26` to **`3.3.1+27`**. - Add a 3.3.1 `CHANGELOG.md` section covering routing, SOCKS5, runtime resilience, lifecycle, notification, privacy and validation changes. ## 14. Validation Validation was run from a clean staging branch based on the same upstream 3.3.0 `main` SHA. The product code matches this release branch; the staging-only workflow is not included in the PR, and the changelog is a docs-only commit added after validation. - Release invariants: **passed** - Native patcher analysis: **passed** - Native patch application: **passed** - Native patch idempotence: **passed** - `flutter analyze --no-fatal-warnings --no-fatal-infos`: **passed** - Flutter regression tests: **4/4 passed** - Android release Kotlin compilation: **passed** - 3.3.1 APK build: **passed** - Packaged VPN runtime verification: **passed** Validation run: https://github.com/Naveax/ReVoltVPN/actions/runs/33419744747 ## 15. Scope intentionally not changed - No vendored `third_party/flutter_vless_android` runtime is added. - No temporary diagnostic/build workflow is included in this PR. - No server-side Hivemind deployment files are changed. - No nginx configuration is changed. - No Reality server configuration is changed. - No productionization/re-enabling of the current AdMob bypass path is included. ## Commit structure The branch contains six reviewable commits following `CONTRIBUTING.md`: 1. `feat(app): add secure routing and runtime resilience` 2. `test(app): cover routing and secure socks migrations` 3. `build(config): bump app version to 3.3.1` 4. `build(config): increase gradle heap for release builds` 5. `fix(app): hide session metadata on lock screen` 6. `docs: document 3.3.1 release changes`
esefxdz commented 2026-08-31 23:25:39 +03:00 (Migrated from github.com)

thanks for the PR, i have landed some changes and notified you via PM

thanks for the PR, i have landed some changes and notified you via PM
Sign in to join this conversation.