feat: Surge for macOS 设置节点字段 _mihomoExternal 为 true 可强制指定使用 mihomo External Proxy Program 输出该节点

This commit is contained in:
xream committed 2026-03-31 15:56:49 +08:00
1 parent 129976467d
commit dea88520fe
4 files changed
+27 -1

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.67",
"version": "2.21.68",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
@@ -11,6 +11,9 @@ const surge_Producer = Surge_Producer();
export default function SurgeMac_Producer() {
const produce = (proxy, type, opts = {}) => {
if (proxy._mihomoExternal) {
return mihomo(proxy, type, opts);
}
switch (proxy.type) {
case 'external':
return external(proxy);
@@ -219,6 +219,28 @@ describe('Proxy text producers', function () {
expect(output).to.include('udp-relay=true');
});
it('forces SurgeMac nodes with _mihomoExternal to use Mihomo external mode', function () {
const output = produceExternal(
'SurgeMac',
{
type: 'tuic',
name: 'Forced Mihomo',
server: 'tuic.example.com',
port: 443,
uuid: UUID,
password: 'secret',
sni: 'sni.example.com',
_mihomoExternal: true,
},
{ localPort: 17777 },
);
expect(output).to.include(
'Forced Mihomo=external,exec="/usr/local/bin/mihomo",local-port=17777',
);
expect(output).to.not.include('Forced Mihomo=tuic-v5');
});
it('produces URI VLESS reality websocket links', function () {
const output = produceExternal('URI', {
type: 'vless',
+1
View File
@@ -35,6 +35,7 @@ function operator(proxies = [], targetPlatform, context) {
// 21. 2.21.59 开始, `sing-box` 支持使用 `ech-opts` 结构设置 `tls` 的 `ech`. 参考 https://github.com/sub-store-org/Sub-Store/pull/563/changes 基本沿用 mihomo 风格, mihomo 部分字段自动转换
// 22. `sing-box` 支持使用完整的 `_curve_preferences` 结构设置 `tls` 的 `curve_preferences`
// 23. `interface-name` 指定流量出站接口 只给 Surge 用的话, `interface` 也可以
// 24. Surge for macOS 可手动指定链接参数 target=SurgeMac 或在 同步配置 中指定 SurgeMac 来启用 mihomo 支援 Surge 本身不支持的协议. 设置节点字段 `_mihomoExternal` 为 `true` 可强制指定使用 mihomo External Proxy Program 输出该节点
// require 为 Node.js 的 require, 在 Node.js 运行环境下 可以用来引入模块
// 例如在 Node.js 环境下, 将文件内容写入 /tmp/1.txt 文件