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
@@ -4,6 +4,14 @@ import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:meshport_client_core/meshport_client_core.dart';
String routingPolicyLabel(Object? action) => switch (action) {
'proxy' => '代理',
'direct' => '直连',
'mesh' => '组网',
'reject' => '拒绝',
_ => '$action',
};
Future<bool> confirmDiscard(BuildContext context) async =>
await showDialog<bool>(
context: context,
@@ -130,6 +138,13 @@ class _RuleEditorState extends State<RuleEditor> {
setState(() => error = '请输入有效域名或 CIDR,不接受星号语法');
return;
}
if (action == 'mesh' &&
type == 'ip_cidr' &&
InternetAddress.tryParse(v.split('/').first)?.type !=
InternetAddressType.IPv4) {
setState(() => error = '组网目前仅支持 IPv4 网段');
return;
}
Navigator.pop(context, {
'type': type,
'value': v,
@@ -159,18 +174,28 @@ class _RuleEditorState extends State<RuleEditor> {
),
TextField(
controller: value,
decoration: const InputDecoration(labelText: '匹配值'),
decoration: InputDecoration(
labelText: '匹配值',
hintText: type == 'ip_cidr'
? '例如 192.168.50.0/24'
: '例如 example.com',
),
),
DropdownButtonFormField<String>(
isExpanded: true,
initialValue: action,
items: const [
DropdownMenuItem(value: 'proxy', child: Text('所选代理')),
DropdownMenuItem(value: 'proxy', child: Text('代理')),
DropdownMenuItem(value: 'direct', child: Text('直连')),
DropdownMenuItem(value: 'mesh', child: Text('组网')),
DropdownMenuItem(value: 'reject', child: Text('拒绝')),
],
onChanged: (v) => setState(() => action = v!),
),
if (action == 'mesh')
const Text(
'需启用代理+组网。目标必须属于已接入的 IPv4 组网网段;未接入时拒绝访问,不回退到代理或直连。此规则不会自动发布远端网段。',
),
const Text('按列表顺序匹配;组网优先,然后普通规则,最后规则集。'),
],
),
@@ -264,7 +289,11 @@ class _RulesPageState extends State<RulesPage> {
subtitle: Text('有效目标走组网;已知失效目标拒绝。不能移动或关闭。'),
),
Text(
widget.profile.mode == 'rule' && widget.profile.feature != 'mesh'
widget.profile.feature == 'mesh'
? '仅组网模式暂停普通规则'
: widget.profile.mode == 'bypass_cn'
? '自定义规则和规则集优先,其后执行私网及中国大陆 IP 直连,其余走代理'
: widget.profile.mode == 'rule'
? '普通规则按顺序执行'
: '当前模式暂停普通规则',
),
@@ -272,7 +301,9 @@ class _RulesPageState extends State<RulesPage> {
Card(
child: ListTile(
title: Text('${entry.$1 + 1}. ${entry.$2['value']}'),
subtitle: Text('${entry.$2['type']} → ${entry.$2['action']}'),
subtitle: Text(
'${entry.$2['type']} → ${routingPolicyLabel(entry.$2['action'])}',
),
onTap: () => edit(entry.$1),
trailing: Wrap(
children: [
@@ -303,7 +334,9 @@ class _RulesPageState extends State<RulesPage> {
const Text('规则集 · 普通规则之后按顺序匹配'),
for (final e in sets.indexed)
ListTile(
title: Text('${e.$2['tag']} → ${e.$2['action']}'),
title: Text(
'${e.$2['tag']} → ${routingPolicyLabel(e.$2['action'])}',
),
subtitle: Text(
e.$2['url'] == null
? '内联规则'
@@ -341,20 +374,25 @@ class _RulesPageState extends State<RulesPage> {
),
),
OutlinedButton(onPressed: () => editSet(), child: const Text('添加规则集')),
DropdownButtonFormField<String>(
isExpanded: true,
initialValue: outlet,
decoration: const InputDecoration(labelText: '固定默认出口'),
items: const [
DropdownMenuItem(value: 'proxy', child: Text('所选代理')),
DropdownMenuItem(value: 'direct', child: Text('直连')),
DropdownMenuItem(value: 'reject', child: Text('拒绝')),
],
onChanged: (v) => setState(() {
outlet = v!;
dirty = true;
}),
),
if (widget.profile.mode == 'bypass_cn')
const Text('预设默认出口:所选代理(未匹配自定义规则、私网及中国大陆 IP 时)'),
if (widget.profile.mode == 'rule')
DropdownButtonFormField<String>(
isExpanded: true,
initialValue: outlet,
decoration: const InputDecoration(labelText: '固定默认出口'),
items: const [
DropdownMenuItem(value: 'proxy', child: Text('代理')),
DropdownMenuItem(value: 'direct', child: Text('直连')),
DropdownMenuItem(value: 'mesh', child: Text('组网')),
DropdownMenuItem(value: 'reject', child: Text('拒绝')),
],
onChanged: (v) => setState(() {
outlet = v!;
dirty = true;
}),
),
if (outlet == 'mesh') const Text('组网默认策略仅允许已接入的组网目标,其他目标拒绝访问。'),
const Text('保存不改变当前会话;应用时需要重连。'),
],
),
@@ -1066,8 +1104,9 @@ class _RuleSetEditorState extends State<RuleSetEditor> {
initialValue: action,
decoration: const InputDecoration(labelText: '匹配后执行'),
items: const [
DropdownMenuItem(value: 'proxy', child: Text('代理')),
DropdownMenuItem(value: 'direct', child: Text('直连')),
DropdownMenuItem(value: 'proxy', child: Text('所选代理')),
DropdownMenuItem(value: 'mesh', child: Text('组网')),
DropdownMenuItem(value: 'reject', child: Text('拒绝')),
],
onChanged: (v) => setState(() {
@@ -1075,7 +1114,11 @@ class _RuleSetEditorState extends State<RuleSetEditor> {
dirty = true;
}),
),
const Text('远程集在规则模式连接期间自动更新并缓存;首次下载失败会阻止连接,后续失败保留已缓存版本。保存后重连生效。'),
if (action == 'mesh')
const Text('需启用代理+组网;规则集匹配到的目标仅在已有组网路由时可达,否则拒绝访问。'),
const Text(
'远程集在自定义规则或绕过中国大陆模式连接期间自动更新并缓存;首次下载失败会阻止连接,后续失败保留已缓存版本。保存后重连生效。',
),
],
),
);
+88 -43
View File
@@ -336,7 +336,7 @@ class _ProxyPanelState extends State<ProxyPanel> {
: (v) => change(() => p.mode = v!),
),
if (p.mode == 'bypass_cn' && p.feature != 'mesh')
const Text('中国大陆 IP 和普通私网直连,其余通过代理。首次使用会下载分流规则。'),
const Text('优先执行自定义分流规则,其余中国大陆 IP 和普通私网直连,其他流量通过代理。首次使用会下载分流规则。'),
Text(
widget.entry == 'application'
? '应用内代理:需要在使用它的软件中设置 SOCKS5 127.0.0.1:10818。'
@@ -475,7 +475,7 @@ class _ProxyPanelState extends State<ProxyPanel> {
subtitle: const Text('网络入口、DNS 与分流规则'),
children: [
Padding(
padding: const EdgeInsets.all(18),
padding: const EdgeInsets.fromLTRB(18, 20, 18, 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -502,62 +502,107 @@ class _ProxyPanelState extends State<ProxyPanel> {
? null
: (v) => widget.entryChanged(v!),
),
const SizedBox(height: 18),
const SizedBox(height: 16),
const Text('修改连接设置后,重连使其生效。'),
const SizedBox(height: 18),
const Divider(height: 48),
Text('分流规则', style: Theme.of(context).textTheme.titleSmall),
const SizedBox(height: 12),
const Text(
'受管理规则:有效组网地址 → 组网;已失效的已知组网地址 → 拒绝;随后才应用普通规则与默认出口。',
),
DropdownButtonFormField<String>(
isExpanded: true,
initialValue: p.defaultAction,
decoration: const InputDecoration(labelText: '规则模式默认出口'),
items: const [
DropdownMenuItem(value: 'proxy', child: Text('所选代理')),
DropdownMenuItem(value: 'direct', child: Text('直连')),
DropdownMenuItem(value: 'reject', child: Text('拒绝')),
],
onChanged:
disabled || p.mode != 'rule' || p.feature == 'mesh'
? null
: (v) => change(() => p.defaultAction = v!),
'组网地址优先走组网;已失效的已知组网地址拒绝访问。',
style: TextStyle(height: 1.5),
),
const SizedBox(height: 16),
if (p.mode == 'rule' && p.feature != 'mesh') ...[
DropdownButtonFormField<String>(
isExpanded: true,
initialValue: p.defaultAction,
decoration: const InputDecoration(
labelText: '规则模式默认出口',
),
items: const [
DropdownMenuItem(value: 'proxy', child: Text('代理')),
DropdownMenuItem(value: 'direct', child: Text('直连')),
DropdownMenuItem(value: 'mesh', child: Text('组网')),
DropdownMenuItem(value: 'reject', child: Text('拒绝')),
],
onChanged: disabled
? null
: (v) => change(() => p.defaultAction = v!),
),
const SizedBox(height: 16),
],
if (p.mode == 'bypass_cn' && p.feature != 'mesh') ...[
const Text(
'自定义规则优先,其余私网及中国大陆 IP 直连,其他流量走代理。',
style: TextStyle(height: 1.5),
),
const SizedBox(height: 12),
],
Text(
'${p.rules.length} 条普通规则 · ${p.mode == 'rule' && p.feature != 'mesh' ? '规则模式执行' : '已暂停'}',
'${p.rules.length} 条普通规则 · '
'${p.ruleSets.where((set) => set['enabled'] == true).length} 个启用规则集 · '
'${{'rule', 'bypass_cn'}.contains(p.mode) && p.feature != 'mesh' ? '按顺序执行' : '已暂停'}',
),
OutlinedButton(
onPressed: disabled
? null
: () => Navigator.push<void>(
context,
MaterialPageRoute(
builder: (_) => RulesPage(
profile: p,
changed: widget.changed,
const SizedBox(height: 12),
Align(
alignment: Alignment.centerLeft,
child: OutlinedButton(
onPressed: disabled
? null
: () => Navigator.push<void>(
context,
MaterialPageRoute(
builder: (_) => RulesPage(
profile: p,
changed: widget.changed,
),
),
),
),
child: const Text('编辑普通规则'),
child: const Text('编辑普通规则'),
),
),
const Divider(height: 48),
Text(
'启动 DNS:${p.dnsServer} · 直连 DNS:${p.directDnsServer.isEmpty ? '启动 DNS' : p.directDnsServer} · 代理 DNS:${p.effectiveProxyDns}',
'DNS 设置',
style: Theme.of(context).textTheme.titleSmall,
),
OutlinedButton(
onPressed: disabled
? null
: () => Navigator.push<void>(
context,
MaterialPageRoute(
builder: (_) => DnsPage(
profile: p,
changed: widget.changed,
const SizedBox(height: 12),
Text(
'启动 DNS:${p.dnsServer}',
style: const TextStyle(height: 1.5),
),
const SizedBox(height: 8),
Text(
'直连 DNS:${p.directDnsServer.isEmpty ? '启动 DNS' : p.directDnsServer}',
style: const TextStyle(height: 1.5),
),
const SizedBox(height: 8),
Text(
'代理 DNS:${p.effectiveProxyDns}',
style: const TextStyle(height: 1.5),
),
const SizedBox(height: 16),
Align(
alignment: Alignment.centerLeft,
child: OutlinedButton(
onPressed: disabled
? null
: () => Navigator.push<void>(
context,
MaterialPageRoute(
builder: (_) => DnsPage(
profile: p,
changed: widget.changed,
),
),
),
),
child: const Text('编辑 DNS'),
child: const Text('编辑 DNS'),
),
),
const SizedBox(height: 16),
Text(
'FakeIP:${p.fakeIP ? '开启' : '关闭'} · 组网域名自动排除,解析失败无公共 DNS 回退。',
style: const TextStyle(height: 1.5),
),
],
),
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshport_client_core/meshport_client_core.dart';
import 'package:meshport_lab/features/configuration_pages.dart';
void main() {
testWidgets('bypass mode edits custom rules and retains preset fallback', (
tester,
) async {
final profile = ProxyProfile()
..feature = 'proxy'
..mode = 'bypass_cn'
..defaultAction = 'reject';
var saved = false;
await tester.pumpWidget(
MaterialApp(
home: Builder(
builder: (context) {
return TextButton(
onPressed: () => Navigator.push<void>(
context,
MaterialPageRoute(
builder: (_) =>
RulesPage(profile: profile, changed: () => saved = true),
),
),
child: const Text('open'),
);
},
),
),
);
await tester.tap(find.text('open'));
await tester.pumpAndSettle();
expect(find.textContaining('自定义规则和规则集优先'), findsOneWidget);
expect(find.text('当前模式暂停普通规则'), findsNothing);
expect(find.text('固定默认出口'), findsNothing);
expect(find.textContaining('预设默认出口:所选代理'), findsOneWidget);
await tester.tap(find.text('添加规则'));
await tester.pumpAndSettle();
await tester.enterText(find.byType(TextField), 'example.com');
await tester.tap(find.text('保存规则'));
await tester.pumpAndSettle();
await tester.tap(find.text('保存草稿'));
await tester.pumpAndSettle();
expect(saved, true);
expect(profile.rules.single, {
'type': 'domain_suffix',
'value': 'example.com',
'action': 'proxy',
});
// Keep the custom-mode fallback draft; the engine owns bypass mode's proxy fallback.
expect(profile.defaultAction, 'reject');
expect(profile.mode, 'bypass_cn');
});
}
@@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshport_client_core/meshport_client_core.dart';
import 'package:meshport_lab/features/configuration_pages.dart';
void main() {
testWidgets('IPv4 subnet rule offers all four policies and saves mesh', (
tester,
) async {
Map<String, dynamic>? saved;
await tester.pumpWidget(
MaterialApp(
home: Builder(
builder: (context) {
return TextButton(
onPressed: () async {
saved = await Navigator.push<Map<String, dynamic>>(
context,
MaterialPageRoute(builder: (_) => const RuleEditor()),
);
},
child: const Text('open'),
);
},
),
),
);
await tester.tap(find.text('open'));
await tester.pumpAndSettle();
await tester.tap(find.byType(DropdownButtonFormField<String>).first);
await tester.pumpAndSettle();
await tester.tap(find.text('IP CIDR').last);
await tester.pumpAndSettle();
await tester.enterText(find.byType(TextField), '192.168.50.0/24');
await tester.tap(find.byType(DropdownButtonFormField<String>).last);
await tester.pumpAndSettle();
for (final label in ['代理', '直连', '组网', '拒绝']) {
expect(find.text(label), findsWidgets);
}
await tester.tap(find.text('组网').last);
await tester.pumpAndSettle();
expect(find.textContaining('不会自动发布远端网段'), findsOneWidget);
await tester.tap(find.text('保存规则'));
await tester.pumpAndSettle();
expect(saved, {
'type': 'ip_cidr',
'value': '192.168.50.0/24',
'action': 'mesh',
});
});
testWidgets('mesh rule refuses unsupported IPv6 subnet', (tester) async {
await tester.pumpWidget(
const MaterialApp(
home: RuleEditor(
rule: {'type': 'ip_cidr', 'value': 'fd00::/64', 'action': 'mesh'},
),
),
);
await tester.tap(find.text('保存规则'));
await tester.pumpAndSettle();
expect(find.text('组网目前仅支持 IPv4 网段'), findsOneWidget);
});
test('mesh policies and legacy reject survive profile persistence', () {
final profile = ProxyProfile()
..feature = 'combined'
..mode = 'bypass_cn'
..defaultAction = 'mesh'
..rules = [
{'type': 'ip_cidr', 'value': '192.168.50.0/24', 'action': 'mesh'},
{'type': 'domain', 'value': 'blocked.test', 'action': 'reject'},
]
..ruleSets = [
{
'tag': 'group-sites',
'enabled': true,
'action': 'mesh',
'rules': [
{
'domain': ['mesh.test'],
},
],
},
];
final restored = ProxyProfile.fromJson(profile.toJson());
expect(restored.runtime()['rules'], profile.rules);
expect(restored.runtime()['rule_sets'], profile.ruleSets);
expect(restored.defaultAction, 'mesh');
expect(routingPolicyLabel('reject'), '拒绝');
expect(routingPolicyLabel('mesh'), '组网');
});
}
@@ -31,6 +31,18 @@ void main() {
await tester.tap(find.text(label).last);
await tester.pumpAndSettle();
expect(tester.takeException(), isNull, reason: label);
if (label == '代理') {
await tester.ensureVisible(find.text('高级设置'));
await tester.tap(find.text('高级设置'));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('DNS 设置'));
expect(
tester.takeException(),
isNull,
reason: 'expanded advanced settings',
);
expect(find.textContaining('代理 DNS:'), findsOneWidget);
}
}
});
}
+6 -2
View File
@@ -17,7 +17,7 @@ Android 本轮已编译,按用户安排暂不安装真机。macOS 图片二维
## 使用入口
- **代理 → 订阅管理 → 编辑订阅**:启用自动更新,选择 15 分钟至 7 天的间隔,返回代理页点击“安全保存配置”。定时器每分钟检查到期项;应用重开也检查逾期项。
- **代理 → 编辑普通规则**:添加、排序、启停规则集。普通规则先匹配,随后规则集,再使用默认出口;组网有效子网和已撤销子网保护始终在前。全局 / 直连模式暂停普通规则和规则集。
- **代理 → 编辑普通规则**:添加、排序、启停规则集。普通规则先匹配,随后规则集,再使用默认出口;组网有效子网和已撤销子网保护始终在前。绕过中国大陆模式同样执行自定义规则及规则集,并优先于私网和大陆 IP 预设。全局 / 直连模式暂停普通规则和规则集。
- **代理 → 编辑 DNS**:启动解析器仍为 IP;直连和代理解析器可填写 IP、`https://主机/dns-query` 或 `tls://主机:853`。DoH 默认 443、DoT 默认 853;TLS 校验保持开启。代理 DNS 经手动所选节点;解析器主机名由独立启动 DNS 解析,避免循环依赖。仅组网模式不接管互联网 DNS。
- **代理 → 导入与预览**:选择文件、相机扫码或二维码图片。只填入草稿,点击“解析并预览”后确认导入。HTTPS 订阅链接可以选择“作为订阅地址添加”。导入普通 sing-box JSON 只提取节点,不能覆盖受管理 TUN、DNS 和组网路由。
- **组网配置**:通过组网页表单填写;原 TOML 导入对话框已移除。保存过的完整 TOML 在未修改表单时原样保留。
@@ -25,6 +25,10 @@ Android 本轮已编译,按用户安排暂不安装真机。macOS 图片二维
## 更新与缓存行为
普通规则、规则集的匹配策略以及自定义规则模式的默认策略提供四项:**代理、直连、组网、拒绝**。代理使用当前所选节点,直连使用本机网络,拒绝终止匹配连接。组网仅允许已接入的 IPv4 组网目标;需要先启用“代理 + 组网”,并由对端发布对应网段。未接入、已撤销或组网出口不可用时拒绝连接,不回退到代理或直连。
例如让 `192.168.50.0/24` 走组网:在对端发布此子网并确认本机已收到有效路由,再添加普通规则,类型选择 IP 网段、内容填写 `192.168.50.0/24`、策略选择“组网”,保存并重连。本地分流规则不会创建或发布远端路由。受管理的有效组网路由和撤销保护始终优先于普通规则;绕过中国大陆模式也可追加此规则。当前不支持 IPv6 组网网段。
订阅只替换自己的来源节点,保留手动节点、其他订阅及相同节点的 ID。选中节点被删除时清空选择,用户需重新选择,不自动换出口。空响应、仅含不支持节点的响应、网络失败或超出 64 KiB 保存限额,都保留旧配置;失败后 15 分钟重试。编辑期间不自动覆盖草稿。更新成功保存到平台安全存储,当前会话的实际出口保持到显式重连。
远程规则集支持 sing-box source JSON 和 `.srs` binary,初次连接下载、连接期间每 1–168 小时更新。它们可选择直连或所选代理下载。首次下载失败且没有缓存会阻止引擎启动;后续下载或解析失败保留最后一份有效规则。缓存与 FakeIP 一样属于当前引擎私有会话,公告引起的重建可复用,释放会话会清理,不保证 APP 重启后离线使用。
@@ -49,7 +53,7 @@ Android 本轮已编译,按用户安排暂不安装真机。macOS 图片二维
域名经真实 IP 解析后匹配,包括 FakeIP 恢复域名后的解析;当前引擎仍以 IPv4 为主。判断按目标 IP,不能保证“中国网站”全部直连。远程列表首次下载失败时连接失败,后续更新失败保留会话内有效列表;跨 APP 重启离线缓存尚未接入。
预设暂停自定义规则、规则集与自定义默认动作,但不覆盖保存内容。全局模式不加载大陆 IP 列表,普通流量全部走代理。原有自定义规则和直连模式仍保留;旧配置不自动切换。修改模式后保存,连接或重连生效,已有连接可能中断。
预设先执行自定义规则、规则集,再执行普通私网及大陆 IP 直连,最后使用所选代理;组网路由和失效保护始终在最前。自定义默认动作仅在自定义规则模式生效,绕过中国大陆的兜底始终为所选代理,不覆盖保存内容。`meshport-geoip-cn` 为预设保留的规则集标识,用户规则集不能占用。全局模式不加载大陆 IP 列表,普通流量全部走代理。原有自定义规则和直连模式仍保留;旧配置不自动切换。修改模式后保存,连接或重连生效,已有连接可能中断。
## 代理 DNS 防泄露
+58 -11
View File
@@ -3,6 +3,7 @@ package bridge
import (
"context"
"encoding/json"
"fmt"
D "github.com/miekg/dns"
box "github.com/sagernet/sing-box"
M "github.com/sagernet/sing/common/metadata"
@@ -38,14 +39,14 @@ func TestBypassChinaPresetAndGlobalIsolation(t *testing.T) {
t.Fatal("preset did not force proxy fallback")
}
sets := route["rule_set"].([]any)
set := sets[0].(map[string]any)
if len(sets) != 1 || set["tag"] != "meshport-geoip-cn" || set["format"] != "binary" || set["download_detour"] != "proxy" || set["update_interval"] != "24h" {
set := sets[1].(map[string]any)
if len(sets) != 2 || sets[0].(map[string]any)["tag"] != "custom" || set["tag"] != "meshport-geoip-cn" || set["format"] != "binary" || set["download_detour"] != "proxy" || set["update_interval"] != "24h" {
t.Fatal("managed GeoIP update missing")
}
rules := route["rules"].([]any)
// DNS hijack/real-IP resolution precede mesh, withdrawn-prefix protection,
// ordinary private addresses and finally the China IP rule.
if len(rules) != 6 || rules[1].(map[string]any)["action"] != "resolve" || rules[2].(map[string]any)["outbound"] != "meshport" || rules[3].(map[string]any)["action"] != "reject" || rules[4].(map[string]any)["ip_is_private"] != true || rules[5].(map[string]any)["outbound"] != "direct" {
// custom rules/sets, ordinary private addresses and finally the China IP rule.
if len(rules) != 8 || rules[1].(map[string]any)["action"] != "resolve" || rules[2].(map[string]any)["outbound"] != "meshport" || rules[3].(map[string]any)["action"] != "reject" || rules[4].(map[string]any)["action"] != "reject" || rules[5].(map[string]any)["rule_set"].([]any)[0] != "custom" || rules[6].(map[string]any)["ip_is_private"] != true || rules[7].(map[string]any)["outbound"] != "direct" {
t.Fatal("GeoIP or mesh priority broken")
}
if len(c.Rules) != 1 || c.RuleSets[0].Tag != "custom" {
@@ -83,6 +84,8 @@ func TestBypassChinaPresetAndGlobalIsolation(t *testing.T) {
// exits, so real-IP/FakeIP policy is exercised without public connections.
func TestBypassChinaRealIPAndFakeIPRouting(t *testing.T) {
for _, fake := range []bool{false, true} {
mesh, mc := socksEcho(t)
defer mesh.Close()
direct, dc := socksEcho(t)
defer direct.Close()
proxy, pc := socksEcho(t)
@@ -95,9 +98,12 @@ func TestBypassChinaRealIPAndFakeIPRouting(t *testing.T) {
m := new(D.Msg)
m.SetReply(r)
ip := "203.0.113.7"
if r.Question[0].Name == "china.test." {
if r.Question[0].Name == "china.test." || r.Question[0].Name == "china-proxy.test." || r.Question[0].Name == "blocked.test." {
ip = "198.51.100.7"
}
if r.Question[0].Name == "private-proxy.test." {
ip = "10.99.0.1"
}
if r.Question[0].Qtype == D.TypeA {
m.Answer = []D.RR{&D.A{Hdr: D.RR_Header{Name: r.Question[0].Name, Rrtype: D.TypeA, Class: D.ClassINET, Ttl: 60}, A: net.ParseIP(ip)}}
}
@@ -107,7 +113,17 @@ func TestBypassChinaRealIPAndFakeIPRouting(t *testing.T) {
defer server.Shutdown()
listener, port := reservePort(t)
listener.Close()
c := Config{ListenPort: port, Feature: "proxy", Mode: "bypass_cn", FakeIP: fake, DNS: socket.LocalAddr().String(), Proxy: map[string]any{"type": "socks", "server": "127.0.0.1", "server_port": proxy.Addr().(*net.TCPAddr).Port}}
c := Config{ListenPort: port, Feature: "combined", MeshSOCKS: mesh.Addr().String(), MeshCIDRs: []string{"10.77.0.0/24"}, ProtectedCIDRs: []string{"10.88.0.0/24"}, Mode: "bypass_cn", FakeIP: fake, DNS: socket.LocalAddr().String(), Proxy: map[string]any{"type": "socks", "server": "127.0.0.1", "server_port": proxy.Addr().(*net.TCPAddr).Port}}
c.Rules = []Rule{
{Type: "ip_cidr", Value: "10.77.0.0/24", Action: "direct"},
{Type: "ip_cidr", Value: "10.88.0.0/24", Action: "proxy"},
{Type: "domain", Value: "china-proxy.test", Action: "proxy"},
{Type: "domain_suffix", Value: "foreign-direct.test", Action: "direct"},
{Type: "domain", Value: "private-proxy.test", Action: "proxy"},
{Type: "domain", Value: "blocked.test", Action: "reject"},
{Type: "ip_cidr", Value: "198.51.100.8/32", Action: "proxy"},
}
c.RuleSets = []RuleSet{{Tag: "user-direct", Enabled: true, Action: "direct", Rules: []map[string]any{{"domain": []string{"set-direct.test"}}}}}
data, err := c.managedJSON()
if err != nil {
t.Fatal(err)
@@ -115,9 +131,17 @@ func TestBypassChinaRealIPAndFakeIPRouting(t *testing.T) {
var generated map[string]any
json.Unmarshal(data, &generated)
route := generated["route"].(map[string]any)
route["rule_set"] = []any{map[string]any{"type": "inline", "tag": "meshport-geoip-cn", "rules": []any{map[string]any{"ip_cidr": []string{"198.51.100.0/24"}}}}}
for i, set := range route["rule_set"].([]any) {
if set.(map[string]any)["tag"] == "meshport-geoip-cn" {
route["rule_set"].([]any)[i] = map[string]any{"type": "inline", "tag": "meshport-geoip-cn", "rules": []any{map[string]any{"ip_cidr": []string{"198.51.100.0/24"}}}}
}
}
outbounds := generated["outbounds"].([]any)
outbounds[0] = map[string]any{"type": "socks", "tag": "direct", "server": "127.0.0.1", "server_port": direct.Addr().(*net.TCPAddr).Port}
for i, outbound := range outbounds {
if outbound.(map[string]any)["tag"] == "direct" {
outbounds[i] = map[string]any{"type": "socks", "tag": "direct", "server": "127.0.0.1", "server_port": direct.Addr().(*net.TCPAddr).Port}
}
}
data, _ = json.Marshal(generated)
ctx := registryContext(context.Background())
options, err := sjson.UnmarshalExtendedContext[option.Options](ctx, data)
@@ -131,7 +155,7 @@ func TestBypassChinaRealIPAndFakeIPRouting(t *testing.T) {
if err = instance.Start(); err != nil {
t.Fatal(err)
}
for _, domain := range []string{"china.test", "foreign.test"} {
for _, domain := range []string{"china.test", "foreign.test", "china-proxy.test", "foreign-direct.test", "private-proxy.test", "set-direct.test", "blocked.test"} {
target := domain
if fake {
conn, err := net.Dial("tcp4", net.JoinHostPort("127.0.0.1", jsonNumber(int(port))))
@@ -156,11 +180,34 @@ func TestBypassChinaRealIPAndFakeIPRouting(t *testing.T) {
}
target = answer.Answer[0].(*D.A).A.String()
}
echoThrough(t, port, M.ParseSocksaddr(net.JoinHostPort(target, "443")), true)
echoThrough(t, port, M.ParseSocksaddr(net.JoinHostPort(target, "443")), domain != "blocked.test")
}
if dc.Load() != 1 || pc.Load() != 1 {
echoThrough(t, port, M.ParseSocksaddr("198.51.100.8:443"), true)
echoThrough(t, port, M.ParseSocksaddr("10.77.0.8:443"), true)
echoThrough(t, port, M.ParseSocksaddr("10.88.0.8:443"), false)
if dc.Load() != 3 || pc.Load() != 4 || mc.Load() != 1 {
t.Fatalf("fake=%v direct=%d proxy=%d", fake, dc.Load(), pc.Load())
}
instance.Close()
}
}
func TestBypassCustomRuleValidationAndReservedTag(t *testing.T) {
c := Config{ListenPort: 12345, Feature: "proxy", Mode: "bypass_cn", Proxy: map[string]any{"type": "socks", "server": "127.0.0.1", "server_port": 12346}}
c.Rules = []Rule{{Type: "domain", Value: "*.example.com", Action: "direct"}}
if _, err := c.managedJSON(); err == nil {
t.Fatal("invalid custom rule was ignored")
}
c.Rules = nil
c.RuleSets = []RuleSet{{Tag: "meshport-geoip-cn", Enabled: true, Action: "proxy", Rules: []map[string]any{{"domain": []string{"example.com"}}}}}
if _, err := c.managedJSON(); err == nil {
t.Fatal("reserved GeoIP tag accepted")
}
c.RuleSets = nil
for i := 0; i < 32; i++ {
c.RuleSets = append(c.RuleSets, RuleSet{Tag: fmt.Sprintf("user-%d", i), Enabled: true, Action: "direct", Rules: []map[string]any{{"domain": []string{"example.com"}}}})
}
if _, err := c.managedJSON(); err != nil {
t.Fatal("managed set consumed a user slot", err)
}
}
+24 -12
View File
@@ -238,15 +238,11 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
if mode != "rule" && mode != "global" && mode != "direct" && mode != "bypass_cn" {
return nil, errors.New("invalid proxy mode")
}
// A managed preset must not inherit custom rules that could override GeoIP.
// User rules override the managed preset, but never mesh routing/protection.
bypassCN := mode == "bypass_cn"
if bypassCN {
mode = "rule"
c.DefaultAction = "proxy"
c.Rules = nil
c.RuleSets = []RuleSet{{Tag: "meshport-geoip-cn", Enabled: true,
URL: "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
Format: "binary", Action: "direct", DownloadDetour: "proxy", UpdateHours: 24}}
}
active, err := prefixes(c.MeshCIDRs)
if err != nil {
@@ -292,7 +288,7 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
if action == "" {
action = "proxy"
}
if action != "proxy" && action != "direct" && action != "reject" {
if action != "proxy" && action != "direct" && action != "mesh" && action != "reject" {
return nil, errors.New("invalid default action")
}
if internet && mode == "global" {
@@ -301,6 +297,11 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
if internet && mode == "direct" {
action = "direct"
}
// Active mesh prefixes are always routed before ordinary policies. A mesh
// fallback therefore rejects everything that did not match that projection.
if action == "mesh" {
action = "reject"
}
routeRules := []any{}
dns := map[string]any{}
defaultResolver := "bootstrap"
@@ -402,9 +403,6 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
if mesh && len(protected) > 0 {
routeRules = append(routeRules, map[string]any{"ip_cidr": protected, "action": "reject"})
}
if internet && bypassCN {
routeRules = append(routeRules, map[string]any{"ip_is_private": true, "action": "route", "outbound": "direct"})
}
usedProxy := internet && action == "proxy"
if internet && mode == "rule" {
if len(c.Rules) > 256 {
@@ -428,7 +426,9 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
return nil, errors.New("unsupported rule type")
}
switch r.Action {
case "reject":
case "reject", "mesh":
// Routable mesh destinations were handled by the managed rules
// above. Never send an unknown mesh target to another outlet.
item["action"] = "reject"
case "direct", "proxy":
item["action"] = "route"
@@ -451,11 +451,14 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
if !set.Enabled || !internet || mode != "rule" {
continue
}
if bypassCN && set.Tag == "meshport-geoip-cn" {
return nil, errors.New("reserved managed rule set tag: meshport-geoip-cn")
}
if !domain(set.Tag) || tags[set.Tag] {
return nil, errors.New("invalid or duplicate rule set tag")
}
tags[set.Tag] = true
if set.Action != "proxy" && set.Action != "direct" && set.Action != "reject" {
if set.Action != "proxy" && set.Action != "direct" && set.Action != "mesh" && set.Action != "reject" {
return nil, errors.New("invalid rule set action")
}
item := map[string]any{"tag": set.Tag}
@@ -495,7 +498,7 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
if internet && mode == "rule" {
ruleSets = append(ruleSets, item)
match := map[string]any{"rule_set": []string{set.Tag}, "action": "route", "outbound": set.Action}
if set.Action == "reject" {
if set.Action == "reject" || set.Action == "mesh" {
delete(match, "outbound")
match["action"] = "reject"
}
@@ -505,6 +508,15 @@ func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
routeRules = append(routeRules, match)
}
}
if internet && bypassCN {
routeRules = append(routeRules, map[string]any{"ip_is_private": true, "action": "route", "outbound": "direct"})
ruleSets = append(ruleSets, map[string]any{
"tag": "meshport-geoip-cn", "type": "remote", "format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
"download_detour": "proxy", "update_interval": "24h",
})
routeRules = append(routeRules, map[string]any{"rule_set": []string{"meshport-geoip-cn"}, "action": "route", "outbound": "direct"})
}
if usedProxy && c.Proxy == nil {
return nil, errors.New("selected proxy node required")
}
+128
View File
@@ -0,0 +1,128 @@
package bridge
import (
"context"
"encoding/json"
"net"
"testing"
D "github.com/miekg/dns"
box "github.com/sagernet/sing-box"
"github.com/sagernet/sing-box/option"
sjson "github.com/sagernet/sing/common/json"
M "github.com/sagernet/sing/common/metadata"
)
func TestMeshPoliciesNeverFallBackToInternet(t *testing.T) {
for _, mode := range []string{"rule", "bypass_cn"} {
for _, state := range []string{"active", "withdrawn", "proxy-only", "mesh-default"} {
if mode == "bypass_cn" && state == "mesh-default" {
continue
}
t.Run(mode+"/"+state, func(t *testing.T) {
mesh, mc := socksEcho(t)
defer mesh.Close()
proxy, pc := socksEcho(t)
defer proxy.Close()
direct, dc := socksEcho(t)
defer direct.Close()
dnsSocket, err := net.ListenPacket("udp4", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
}
dnsServer := &D.Server{PacketConn: dnsSocket, Handler: D.HandlerFunc(func(w D.ResponseWriter, r *D.Msg) {
m := new(D.Msg)
m.SetReply(r)
if r.Question[0].Qtype == D.TypeA {
m.Answer = []D.RR{&D.A{Hdr: D.RR_Header{Name: r.Question[0].Name, Rrtype: D.TypeA, Class: D.ClassINET, Ttl: 60}, A: net.ParseIP("203.0.113.33")}}
}
w.WriteMsg(m)
})}
go dnsServer.ActivateAndServe()
defer dnsServer.Shutdown()
entry, port := reservePort(t)
entry.Close()
c := Config{ListenPort: port, Feature: "combined", Mode: mode, DefaultAction: "direct", DNS: dnsSocket.LocalAddr().String(),
MeshSOCKS: mesh.Addr().String(), MeshCIDRs: []string{"10.77.0.0/24"}, ProtectedCIDRs: []string{"10.77.0.0/24"},
Proxy: map[string]any{"type": "socks", "server": "127.0.0.1", "server_port": proxy.Addr().(*net.TCPAddr).Port},
Rules: []Rule{{Type: "ip_cidr", Value: "10.77.0.0/24", Action: "mesh"}, {Type: "ip_cidr", Value: "10.44.0.0/24", Action: "mesh"}, {Type: "domain_suffix", Value: "mesh-policy.test", Action: "mesh"}},
RuleSets: []RuleSet{{Tag: "group-subnets", Enabled: true, Action: "mesh", Rules: []map[string]any{{"ip_cidr": []string{"10.55.0.0/24"}}}}},
}
if state == "withdrawn" {
c.MeshCIDRs = nil
}
if state == "proxy-only" {
c.Feature = "proxy"
c.MeshCIDRs = nil
c.ProtectedCIDRs = nil
}
if state == "mesh-default" {
c.DefaultAction = "mesh"
}
data, err := c.managedJSON()
if err != nil {
t.Fatal(err)
}
var generated map[string]any
if err = json.Unmarshal(data, &generated); err != nil {
t.Fatal(err)
}
route := generated["route"].(map[string]any)
if sets, ok := route["rule_set"].([]any); ok {
for i, set := range sets {
if set.(map[string]any)["tag"] == "meshport-geoip-cn" {
sets[i] = map[string]any{"type": "inline", "tag": "meshport-geoip-cn", "rules": []any{map[string]any{"ip_cidr": []string{"198.51.100.0/24"}}}}
}
}
}
for i, out := range generated["outbounds"].([]any) {
if out.(map[string]any)["tag"] == "direct" {
generated["outbounds"].([]any)[i] = map[string]any{"type": "socks", "tag": "direct", "server": "127.0.0.1", "server_port": direct.Addr().(*net.TCPAddr).Port}
}
}
data, _ = json.Marshal(generated)
ctx := registryContext(context.Background())
options, err := sjson.UnmarshalExtendedContext[option.Options](ctx, data)
if err != nil {
t.Fatal(err)
}
instance, err := box.New(box.Options{Context: ctx, Options: options})
if err != nil {
t.Fatal(err)
}
defer instance.Close()
if err = instance.Start(); err != nil {
t.Fatal(err)
}
active := state == "active" || state == "mesh-default"
echoThrough(t, port, M.ParseSocksaddr("10.77.0.8:443"), active)
for _, target := range []string{"10.44.0.8:443", "10.55.0.8:443", "host.mesh-policy.test:443"} {
echoThrough(t, port, M.ParseSocksaddr(target), false)
}
echoThrough(t, port, M.ParseSocksaddr("203.0.113.9:443"), state != "mesh-default")
wantMesh := int32(0)
if active {
wantMesh = 1
}
wantProxy, wantDirect := int32(0), int32(0)
if state != "mesh-default" {
if mode == "bypass_cn" {
wantProxy = 1
} else {
wantDirect = 1
}
}
if mc.Load() != wantMesh || pc.Load() != wantProxy || dc.Load() != wantDirect {
t.Fatalf("unexpected outlet: mesh=%d proxy=%d direct=%d", mc.Load(), pc.Load(), dc.Load())
}
if active {
mesh.Close()
echoThrough(t, port, M.ParseSocksaddr("10.77.0.8:443"), false)
if pc.Load() != wantProxy || dc.Load() != wantDirect {
t.Fatal("unavailable mesh bridge fell back to internet")
}
}
})
}
}
}
@@ -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.