mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 15:09:03 +08:00
feat: Trojan URI 支持 gRPC
This commit is contained in:
parent
a22df97a51
commit
c0ab301160
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.135",
|
"version": "2.14.136",
|
||||||
"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": {
|
||||||
|
@ -90,6 +90,12 @@ params = "/"? "?" head:param tail:("&"@param)* {
|
|||||||
|
|
||||||
if (params["type"]) {
|
if (params["type"]) {
|
||||||
proxy.network = params["type"]
|
proxy.network = params["type"]
|
||||||
|
if (['grpc'].includes(proxy.network)) {
|
||||||
|
proxy[proxy.network + '-opts'] = {
|
||||||
|
'grpc-service-name': params["serviceName"],
|
||||||
|
'_grpc-type': params["mode"],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
if (params["path"]) {
|
if (params["path"]) {
|
||||||
$set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"]));
|
$set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"]));
|
||||||
}
|
}
|
||||||
@ -97,6 +103,7 @@ params = "/"? "?" head:param tail:("&"@param)* {
|
|||||||
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proxy.udp = toBool(params["udp"]);
|
proxy.udp = toBool(params["udp"]);
|
||||||
proxy.tfo = toBool(params["tfo"]);
|
proxy.tfo = toBool(params["tfo"]);
|
||||||
|
@ -88,6 +88,12 @@ params = "/"? "?" head:param tail:("&"@param)* {
|
|||||||
|
|
||||||
if (params["type"]) {
|
if (params["type"]) {
|
||||||
proxy.network = params["type"]
|
proxy.network = params["type"]
|
||||||
|
if (['grpc'].includes(proxy.network)) {
|
||||||
|
proxy[proxy.network + '-opts'] = {
|
||||||
|
'grpc-service-name': params["serviceName"],
|
||||||
|
'_grpc-type': params["mode"],
|
||||||
|
};
|
||||||
|
} else {
|
||||||
if (params["path"]) {
|
if (params["path"]) {
|
||||||
$set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"]));
|
$set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"]));
|
||||||
}
|
}
|
||||||
@ -95,6 +101,7 @@ params = "/"? "?" head:param tail:("&"@param)* {
|
|||||||
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
$set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proxy.udp = toBool(params["udp"]);
|
proxy.udp = toBool(params["udp"]);
|
||||||
proxy.tfo = toBool(params["tfo"]);
|
proxy.tfo = toBool(params["tfo"]);
|
||||||
|
@ -201,6 +201,21 @@ export default function URI_Producer() {
|
|||||||
let trojanTransport = '';
|
let trojanTransport = '';
|
||||||
if (proxy.network) {
|
if (proxy.network) {
|
||||||
trojanTransport = `&type=${proxy.network}`;
|
trojanTransport = `&type=${proxy.network}`;
|
||||||
|
if (['grpc'].includes(proxy.network)) {
|
||||||
|
let trojanTransportServiceName =
|
||||||
|
proxy[`${proxy.network}-opts`]?.[
|
||||||
|
`${proxy.network}-service-name`
|
||||||
|
];
|
||||||
|
if (trojanTransportServiceName) {
|
||||||
|
trojanTransport += `&serviceName=${encodeURIComponent(
|
||||||
|
trojanTransportServiceName,
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
|
trojanTransport += `&mode=${encodeURIComponent(
|
||||||
|
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
|
||||||
|
'gun',
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
let trojanTransportPath =
|
let trojanTransportPath =
|
||||||
proxy[`${proxy.network}-opts`]?.path;
|
proxy[`${proxy.network}-opts`]?.path;
|
||||||
let trojanTransportHost =
|
let trojanTransportHost =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user