mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-13 07:29:00 +08:00
feat: gRPC 支持 authority
This commit is contained in:
parent
dda8113a42
commit
4ea84118c4
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.434",
|
"version": "2.14.435",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -380,6 +380,7 @@ function URI_VMess() {
|
|||||||
proxy[`${proxy.network}-opts`] = {
|
proxy[`${proxy.network}-opts`] = {
|
||||||
'grpc-service-name': getIfNotBlank(transportPath),
|
'grpc-service-name': getIfNotBlank(transportPath),
|
||||||
'_grpc-type': getIfNotBlank(params.type),
|
'_grpc-type': getIfNotBlank(params.type),
|
||||||
|
'_grpc-authority': getIfNotBlank(params.authority),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const opts = {
|
const opts = {
|
||||||
@ -515,6 +516,9 @@ function URI_VLESS() {
|
|||||||
}
|
}
|
||||||
if (params.serviceName) {
|
if (params.serviceName) {
|
||||||
opts[`${proxy.network}-service-name`] = params.serviceName;
|
opts[`${proxy.network}-service-name`] = params.serviceName;
|
||||||
|
if (['grpc'].includes(proxy.network) && params.authority) {
|
||||||
|
opts['_grpc-authority'] = params.authority;
|
||||||
|
}
|
||||||
} else if (isShadowrocket && params.path) {
|
} else if (isShadowrocket && params.path) {
|
||||||
if (!['ws', 'http', 'h2'].includes(proxy.network)) {
|
if (!['ws', 'http', 'h2'].includes(proxy.network)) {
|
||||||
opts[`${proxy.network}-service-name`] = params.path;
|
opts[`${proxy.network}-service-name`] = params.path;
|
||||||
|
@ -101,6 +101,7 @@ params = "?" head:param tail:("&"@param)* {
|
|||||||
proxy[proxy.network + '-opts'] = {
|
proxy[proxy.network + '-opts'] = {
|
||||||
'grpc-service-name': params["serviceName"],
|
'grpc-service-name': params["serviceName"],
|
||||||
'_grpc-type': params["mode"],
|
'_grpc-type': params["mode"],
|
||||||
|
'_grpc-authority': params["authority"],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (params["path"]) {
|
if (params["path"]) {
|
||||||
|
@ -99,6 +99,7 @@ params = "?" head:param tail:("&"@param)* {
|
|||||||
proxy[proxy.network + '-opts'] = {
|
proxy[proxy.network + '-opts'] = {
|
||||||
'grpc-service-name': params["serviceName"],
|
'grpc-service-name': params["serviceName"],
|
||||||
'_grpc-type': params["mode"],
|
'_grpc-type': params["mode"],
|
||||||
|
'_grpc-authority': params["authority"],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (params["path"]) {
|
if (params["path"]) {
|
||||||
|
@ -175,6 +175,7 @@ export default function Clash_Producer() {
|
|||||||
proxy[`${proxy.network}-opts`]
|
proxy[`${proxy.network}-opts`]
|
||||||
) {
|
) {
|
||||||
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
||||||
|
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
|
||||||
}
|
}
|
||||||
return proxy;
|
return proxy;
|
||||||
});
|
});
|
||||||
|
@ -190,6 +190,7 @@ export default function ClashMeta_Producer() {
|
|||||||
proxy[`${proxy.network}-opts`]
|
proxy[`${proxy.network}-opts`]
|
||||||
) {
|
) {
|
||||||
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
||||||
|
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
|
||||||
}
|
}
|
||||||
return proxy;
|
return proxy;
|
||||||
});
|
});
|
||||||
|
@ -193,6 +193,7 @@ export default function ShadowRocket_Producer() {
|
|||||||
proxy[`${proxy.network}-opts`]
|
proxy[`${proxy.network}-opts`]
|
||||||
) {
|
) {
|
||||||
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
||||||
|
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
|
||||||
}
|
}
|
||||||
return proxy;
|
return proxy;
|
||||||
});
|
});
|
||||||
|
@ -289,6 +289,7 @@ export default function Stash_Producer() {
|
|||||||
proxy[`${proxy.network}-opts`]
|
proxy[`${proxy.network}-opts`]
|
||||||
) {
|
) {
|
||||||
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
|
||||||
|
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
|
||||||
}
|
}
|
||||||
return proxy;
|
return proxy;
|
||||||
});
|
});
|
||||||
|
@ -134,6 +134,8 @@ export default function URI_Producer() {
|
|||||||
result.type =
|
result.type =
|
||||||
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
|
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
|
||||||
'gun';
|
'gun';
|
||||||
|
result.host =
|
||||||
|
proxy[`${proxy.network}-opts`]?.['_grpc-authority'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = 'vmess://' + Base64.encode(JSON.stringify(result));
|
result = 'vmess://' + Base64.encode(JSON.stringify(result));
|
||||||
@ -196,6 +198,13 @@ export default function URI_Producer() {
|
|||||||
vlessTransport += `&mode=${encodeURIComponent(
|
vlessTransport += `&mode=${encodeURIComponent(
|
||||||
proxy[`${proxy.network}-opts`]?.['_grpc-type'] || 'gun',
|
proxy[`${proxy.network}-opts`]?.['_grpc-type'] || 'gun',
|
||||||
)}`;
|
)}`;
|
||||||
|
const authority =
|
||||||
|
proxy[`${proxy.network}-opts`]?.['_grpc-authority'];
|
||||||
|
if (authority) {
|
||||||
|
vlessTransport += `&authority=${encodeURIComponent(
|
||||||
|
authority,
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let vlessTransportServiceName =
|
let vlessTransportServiceName =
|
||||||
@ -261,11 +270,18 @@ export default function URI_Producer() {
|
|||||||
proxy[`${proxy.network}-opts`]?.[
|
proxy[`${proxy.network}-opts`]?.[
|
||||||
`${proxy.network}-service-name`
|
`${proxy.network}-service-name`
|
||||||
];
|
];
|
||||||
|
let trojanTransportAuthority =
|
||||||
|
proxy[`${proxy.network}-opts`]?.['_grpc-authority'];
|
||||||
if (trojanTransportServiceName) {
|
if (trojanTransportServiceName) {
|
||||||
trojanTransport += `&serviceName=${encodeURIComponent(
|
trojanTransport += `&serviceName=${encodeURIComponent(
|
||||||
trojanTransportServiceName,
|
trojanTransportServiceName,
|
||||||
)}`;
|
)}`;
|
||||||
}
|
}
|
||||||
|
if (trojanTransportAuthority) {
|
||||||
|
trojanTransport += `&authority=${encodeURIComponent(
|
||||||
|
trojanTransportAuthority,
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
trojanTransport += `&mode=${encodeURIComponent(
|
trojanTransport += `&mode=${encodeURIComponent(
|
||||||
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
|
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
|
||||||
'gun',
|
'gun',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user