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