把入站固定到某条订阅线路

订阅线路不在内核的全局名字表里,入站的 proxy 指不到它(决策记录 0005)。做法是自动建
一个只装它的策略组再指过去,用户看到的只是「这个口固定走这条线」,组是实现细节:
不出现在策略组列表里,列表和详情里都显示成线路本身的名字,没人再引用时自动删掉。

筛选条件必须做对两件事,都写了测试:转义正则元字符(线路名形如 [vmess]DMIT.LAX.Pro
里的方括号和点不转义会匹配错),以及前后加锚点(内核是部分匹配,不加锚点时「香港01」
会把「香港011」也捞进来)。线路名含反引号时表达不了——那是内核切分多个筛选条件的
分隔符——这种情况明说做不到而不是生成一个会静默匹配错的组。

实测:生成的配置 mihomo -t 通过;起一个临时内核问 /proxies,这个组解析出来的成员
恰好只有那一条线路,且确实进了名字表所以入站指得到。
This commit is contained in:
im0o
2026-08-10 19:33:44 +08:00
parent 08ab73a4f1
commit cb8effe05b
6 changed files with 333 additions and 6 deletions
+2 -1
View File
@@ -5,6 +5,7 @@
* 只管显示和选中,不碰任何数据。
*/
import { inboundTypeLabel, isUnsetOutbound, outboundLabel } from '@shared/inbounds.ts'
import { displayOutboundName } from '@shared/filter-groups.ts'
import type { Inbound } from '@shared/inbounds.ts'
defineProps<{ inbounds: Inbound[] }>()
@@ -26,7 +27,7 @@ const selected = defineModel<string | null>('selected', { required: true })
<span v-if="inbound.isDefault" class="tag">默认</span>
</span>
<span :class="['out mono', isUnsetOutbound(inbound.outbound) && 'is-muted']">
{{ outboundLabel(inbound.outbound) }}
{{ displayOutboundName(outboundLabel(inbound.outbound)) }}
</span>
</button>
</li>