feat: VMess URI 支持 TCP/H2 传输层

This commit is contained in:
xream 2024-06-03 21:14:07 +08:00
parent 8cd0545023
commit c5a417da8f
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.332",
"version": "2.14.333",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@ -305,8 +305,9 @@ function URI_VMess() {
if (params.net === 'ws' || params.obfs === 'websocket') {
proxy.network = 'ws';
} else if (
['tcp', 'http'].includes(params.net) ||
params.obfs === 'http'
['http'].includes(params.net) ||
['http'].includes(params.obfs) ||
['http'].includes(params.type)
) {
proxy.network = 'http';
} else if (['grpc'].includes(params.net)) {
@ -317,6 +318,8 @@ function URI_VMess() {
) {
proxy.network = 'ws';
httpupgrade = true;
} else if (params.net === 'h2' || proxy.network === 'h2') {
proxy.network = 'h2';
}
if (proxy.network) {
let transportHost = params.host ?? params.obfsParam;
@ -332,6 +335,10 @@ function URI_VMess() {
if (proxy.network === 'http') {
if (transportHost) {
// 1)http(tcp)->host中间逗号(,)隔开
transportHost = transportHost
.split(',')
.map((i) => i.trim());
transportHost = Array.isArray(transportHost)
? transportHost[0]
: transportHost;