sub-store-org / Sub-Store

Advanced Subscription Manager for QX, Loon, Surge, Stash, Egern and Shadowrocket!
GNU Affero General Public License v3.0
5.55k stars 613 forks source link

希望增加对 Surge VmessAEAD 参数的适配 #70

Closed microka closed 2 years ago

microka commented 2 years ago

https://community.nssurge.com/d/786-ios-surge-vmessws 目前 Surge4 tf 使用 Vmess 节点需要附上参数 vmess-aead = true 方可正常使用,希望 sub-store 能够对 Vmess 节点增加该参数选项。

oldzhg commented 2 years ago

同求适配,想着应该可以通过脚本操作里的js脚本实现的,奈何不会写,或者希望能给个添加参数的js脚本示例。

oldzhg commented 2 years ago

写出来了但是不知道为什么没有作用,还是无法正常连接

function operator(proxies) {
    return proxies.map(p => {
        if (p.type == "vmess") {
            Object.defineProperty(p, "vmess-aead", {
                value: true,
                writable: true,
                enumerable: true,
                configurable: true
            });
        }
        return p;
    });
}
Peng-YM commented 2 years ago

写出来了但是不知道为什么没有作用,还是无法正常连接

function operator(proxies) {
    return proxies.map(p => {
        if (p.type == "vmess") {
            Object.defineProperty(p, "vmess-aead", {
                value: true,
                writable: true,
                enumerable: true,
                configurable: true
            });
        }
        return p;
    });
}

可以暂时使用修改自 @NobyDa 大佬的曲线救国写法,你可以使用「脚本操作」添加任意参数:

function operator(proxies) {
    proxies.forEach(p => {
        if (p.type === "vmess") p.tfo = `${p.tfo||false},vmess-aead=true`;
    });
    return proxies;
}

后续有时间会一并适配最近 TF 的改动

Peng-YM commented 2 years ago

已适配

oldzhg commented 2 years ago

好像有点问题,连不上,勾选强制开启vmess-aead后,生成节点信息如下,连接失败

  {
    "type": "vmess",
    "name": "",
    "server": "",
    "port": "",
    "cipher": "chacha20-poly1305",
    "uuid": "",
    "alterId": 0,
    "tls": false,
    "udp": true,
    "tfo": true,
    "vmess-aead": true
    "skip-cert-verify": false,
  },

用你上面发的脚本才能连接,信息如下

  {
    "type": "vmess",
    "name": "",
    "server": "",
    "port": "",
    "cipher": "chacha20-poly1305",
    "uuid": "",
    "alterId": 0,
    "tls": false,
    "udp": true,
    "tfo": "true,vmess-aead=true",
    "skip-cert-verify": false,
  },

这样看的话写在tfo里面才行?

Peng-YM commented 2 years ago

AEAD开关和脚本操作是不是同时使用了?

oldzhg commented 2 years ago

没有的,只开启了开关,因为我之前也尝试添加这个属性 "vmess-aead": true也是连不上

Peng-YM commented 2 years ago

麻烦你看一下两种方式生成的节点有什么异同?

oldzhg commented 2 years ago

用开关的话,是这样

"tfo": true,
"vmess-aead": true

脚本生成是这样

"tfo": "true,vmess-aead=true",
Peng-YM commented 2 years ago

请在订阅链接后面加上 ?target=Surge