feat: support custom bypass rules and mesh routing policies

This commit is contained in:
shen
2026-10-15 07:06:34 -07:00
parent dc1bfc99d2
commit c1d0739b95
14 changed files with 621 additions and 89 deletions
@@ -0,0 +1,11 @@
# Advanced settings spacing and OPPO install — 2026-10-15
- Advanced settings now separate network entry, routing and DNS with section spacing/dividers. Explanations no longer touch field labels. DNS values use separate lines; edit buttons align left. Bypass-CN indicates custom rules execute, and the inactive custom-mode default-outlet selector is hidden.
- Full Flutter suite: 58 passed / 8 native-dependent skipped; analyzer clean. Existing responsive test now expands advanced settings at 360/800 logical pixels and 1.4 text scale, checks DNS content and absence of layout exceptions.
- Android standalone APK: `outputs/android/MeshPort-Standalone-0.1.0-1792071549-release.apk`; SHA-256 `c51ae30374f4a15bc9d910bfee76ae5de1a3e2ac2a26fd08bc264c74b8c666da`.
- macOS ZIP: `outputs/macos/MeshPort-0.1.0-1792071575-arm64-release.zip`; SHA-256 `7a30b4b04c17eea53aa1d6a5bc1abc601f54b6a3840303087781c626a664d033`.
- UI-only rebuild reused verified native cores from the preceding custom-rule packages (Android normal APK 1792070639 and macOS ZIP 1792070555). Android Rust/Go libraries byte-match those inputs. No engine source changed in this spacing update. Public template and archive integrity verified on both; macOS deep/strict Apple Development signature and APK v2/ZIP 16KB alignment verified. macOS is not Developer ID/notarized.
- Temporary packaging wrapper initially failed to restore source config because it changed working directory while retaining a relative path. The exact local backup was recovered and byte-verified, and the wrapper corrected to use an absolute path. Installers were separately verified to contain only the public template.
- OPPO PJZ110: original application ID had a different certificate (`6f8b4aa0849720503caa090ceb87fce68418139b4b71d105531530546cf6c53e`) and was installed only in another user space. It was not uninstalled or modified. Installed `com.meshport.client.standalone` into current primary user 0 with persistent independent certificate `ab8bc33b6441aec319fb7b585038efb1f1550f12d1fc5b9de8fd11d4302b7c4d`.
- ADB install succeeded; MainActivity cold launch returned Status ok (811 ms). Version 1792071549, installed user 0, live PID and resumed activity verified. No AndroidRuntime/Flutter startup errors found in the filtered log. No phone VPN connection or routing test performed.
- macOS output app launched successfully. UI restored saved profiles and showed the new routing/DNS sections and active bypass-CN rule status. Existing installed macOS app was not replaced. No commits or pushes performed.
@@ -0,0 +1,13 @@
# Bypass-CN custom rules — 2026-10-15
The managed bypass-CN preset now keeps user rules and enabled rule sets. Effective routing order (after managed DNS processing): mesh DNS/active mesh routes, withdrawn-prefix rejection, ordered custom rules, ordered custom rule sets, ordinary private-IP direct, managed China-IP direct, existing video fallback, proxy final. The custom-mode default action remains saved but does not alter bypass-CN's proxy final. Global/direct still pause user routing rules.
The built-in GeoIP set is appended after custom rule sets, with its tag `meshport-geoip-cn` reserved to avoid collisions. It does not consume one of the 32 user-set slots. Existing download/cache behavior remains unchanged. UI explains precedence and hides the inactive custom default-action selector outside custom-rule mode. macOS/Android share these engine/UI changes; no platform networking layer or DNS configuration was added.
Validation:
- Full Go suite, race suite and vet passed.
- Real SOCKS counter fixtures test China targets forced to proxy, foreign targets forced direct, private-IP override, custom CIDR and rule-set override, rejection and unchanged preset fallback, with real-IP and FakeIP DNS paths. Active mesh and withdrawn routes cannot be overridden by user rules.
- Validation covers invalid custom rules, reserved tag collisions, all 32 user-set slots and original saved-rule preservation/global-mode isolation.
- Flutter: 58 passed, 8 native-library-dependent tests skipped; analyzer clean. New UI test edits and saves a custom rule while retaining bypass mode and the saved custom-mode default action.
No updated installer, live privileged VPN verification, commit or push was performed for this change. The earlier macOS package/live verification predates this behavior.
@@ -0,0 +1,11 @@
# Custom bypass rules packages and Android device upgrade — 2026-10-15
Packages include the new bypass-CN custom ordinary rules and rule sets, ahead of private/China-IP defaults and behind mesh/withdrawal protection. Source includes uncommitted changes on top of main dc1bfc9; no commit/push performed.
- macOS ZIP: `outputs/macos/MeshPort-0.1.0-1792070555-arm64-release.zip`; SHA-256 `62b9bd2592945a31e0440e6341d4a608a33583c09281415d95edd681a1844bcd`. Apple Silicon/macOS 12+, Release, Apple Development signed, not Developer ID/notarized. Deep/strict signature, archive and public template checks passed.
- Android APK: `outputs/android/MeshPort-0.1.0-1792070639-release.apk`; SHA-256 `0591703609c9b8ac9c8c4288f59777f9d16fd3e093056a3d169b917a4a649076`. ARM64/Android 8+, Release AOT; original application ID `com.example.meshport_lab`.
- Installed old APK certificate matched the existing Android Debug signing identity (SHA-256 `3c116d75d22a71f1a32a443d524c6293965b29c1647a7ac1cd41fcf13a312ec8`). Built the compatible original-ID variant instead of independent app to support an in-place upgrade on the connected phone. Debug certificate is reused for compatibility; this is not a store distribution identity.
- APK signature v2, archive/public config/AOT, ZIP 16 KB alignment and native ELF alignment checks passed.
- Connected Xiaomi MI 8 Lite (Android 15/API 35) upgraded with `adb install -r`: Success. Version code verified as 1792070639; firstInstallTime unchanged (October 12), lastUpdateTime advanced. No uninstall performed. Old app files/preferences backed up privately under ignored `work/android-device-backups/` before upgrade; never printed credential contents.
- MainActivity started with Status ok (cold launch 623 ms), resumed activity and running PID verified. Native ABI loaded successfully; no AndroidRuntime/Flutter error found in startup log. The app reported loading public default configuration; this does not prove restoration/migration of any prior user profile.
- Phone VPN connection and rule routing were not tested in this installation request. Feature validation before packaging: Flutter 58 passed/8 native-dependent skipped, analyzer clean, Go suite/race/vet passed with real-IP/FakeIP route-counter fixtures.
@@ -0,0 +1,22 @@
# 四项分流策略验证
日期:2026-10-15
- 普通规则、规则集和自定义规则默认策略统一显示:代理、直连、组网、拒绝。
- 新增 `mesh` 策略,旧 `reject` 配置保持兼容,列表显示中文策略名。
- 组网使用受管理的有效 IPv4 路由;普通策略不会生成远端路由。有效组网路由优先,未接入目标和撤销路由拒绝访问,不回退到互联网出口。
- 规则编辑器支持 IPv4 CIDR 示例,组网 IPv6 CIDR 显式报错。
验证结果:
- Flutter 全量测试:61 通过,8 跳过(缺少本地 Rust 动态库的原生测试)。
- Flutter analyze:无问题。
- Go 全量测试、竞态测试和 vet:通过。
- 新增真实本地 SOCKS/DNS 引擎测试,覆盖自定义/绕过中国大陆模式、已接入/撤销/仅代理/组网默认策略、CIDR/域名/规则集策略以及组网出口失效,无外网请求。
- 新增 Flutter 测试覆盖四项菜单、IPv4 网段保存、IPv6 提示及配置往返。
Android 安装包:`outputs/android/MeshPort-Standalone-0.1.0-1792072527-release.apk`,原生 Rust/Go 与 Flutter 均重新编译。APK 签名校验、16 KiB ZIP 对齐检查通过;内置配置与公开示例 SHA-256 一致。
已通过 `adb install -r --user 0` 覆盖安装至 OPPO PJZ110(3B1F5RE8WTX884UM),返回 Success,版本号已核对为 1792072527。签名与此前独立版一致,未卸载应用,用户数据目录 inode 保持不变。启动返回 Status: ok,进程存活,未观察到 AndroidRuntime/Flutter 错误。
尚未进行新版真机组网连接验收,macOS 安装包尚未更新。
@@ -0,0 +1,35 @@
# macOS packaged app live verification — 2026-10-15
Source: main `dc1bfc9`. Artifact: `outputs/macos/MeshPort-0.1.0-1792060364-arm64-release.zip` (expanded signed app retained alongside it).
ZIP SHA-256: `0308b4c704e3d443de1d4e0fcc810001085c321c3ad25cb044c8e82d5e2cdfe0`.
Apple Silicon, macOS 12+, Release; Apple Development signature, not Developer ID/notarized. Deep/strict signature, ZIP integrity, helper inclusion and exact public default configuration passed.
## Packaged engine and privileged helper
- Packaged local proxy with the saved node: HTTPS 204 and 5 MiB download passed; local proxy did not modify the default route.
- Packaged helper `--self-test`: isolated OS TCP/UDP through utun, advertised subnet withdrawal and interface/default route cleanup passed.
- `--self-test-unified`: isolated OS TCP/UDP through sing-box TUN, Rust SOCKS and EasyTier passed; test route cleanup and default route preservation passed.
- `--self-test-unified-rebuild`: announcement convergence and three forced combined-mode rebuilds passed, including retiring TUN cleanup.
- Actual saved node: system proxy and combined modes both reached HTTPS and downloaded 5 MiB. Combined mode initially discovered two remote peers. Each mode restored the previous default route and DNS snapshot after stopping.
- The advertised subnet matching the local physical LAN was excluded as designed; isolated tests separately exercised accepted advertised subnet routing. No echo service on the user's remote peers was required or tested.
## Actual APP interface
- Launched the new output bundle without replacing the installed app; saved profiles restored. Overview speed card, proxy page and log scope filter displayed correctly.
- Connected via APP in combined/bypass-CN unified VPN mode after normal OS authorization. Four remote nodes were visible, including direct and punched links; ordinary system HTTPS returned 204. Actual proxy connection/DNS/outbound events appeared in the APP.
- Built-in speed test completed 32 MiB: 34.0 Mbps / 4.25 MB/s, first byte 1002 ms.
- Disconnected and reconnected from the APP: same authenticated helper PID, no additional authorization prompt, HTTPS 204 passed. Final disconnect returned the UI to Stopped, removed the desktop TUN address and restored the physical default route. Idle helper remains owned by the open APP for authorized reconnect reuse.
- Native local profile storage checks passed (persistence, migration, permissions, atomic writes, limits and corruption/symlink handling).
## Throughput check
Same Cloudflare 10 MiB resource, alternating three serial rounds, current proxy versus curl bound to physical en0 while the TUN was active:
| Path | Rounds (Mbps) | Average (Mbps) |
|---|---|---|
| Proxy | 26.0 / 21.8 / 25.3 | 24.4 |
| Physical direct | 26.4 / 22.9 / 22.5 | 24.0 |
No material proxy-vs-direct throughput gap appeared in this sample. This is not a controlled old-vs-new application comparison and cannot establish absence of a version regression. It is also not comparable to earlier YouTube CDN/QUIC/video connection-speed figures. No long-duration, network-switching or real game session test performed.
Raw local captures remain under ignored `work/macos-validation/`; no credentials or complete user profile is included in this summary. All automated helper checks passed. No application source code was changed in this verification.