fix: Loon 传输层

This commit is contained in:
xream 2024-01-17 21:24:17 +08:00
parent 614438ae3d
commit bbaac2de6f
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.14.175", "version": "2.14.176",
"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": {

View File

@ -93,7 +93,9 @@ function trojan(proxy) {
result.append( result.append(
`${proxy.name}=trojan,${proxy.server},${proxy.port},"${proxy.password}"`, `${proxy.name}=trojan,${proxy.server},${proxy.port},"${proxy.password}"`,
); );
if (proxy.network === 'tcp') {
delete proxy.network;
}
// transport // transport
if (isPresent(proxy, 'network')) { if (isPresent(proxy, 'network')) {
if (proxy.network === 'ws') { if (proxy.network === 'ws') {
@ -118,7 +120,7 @@ function trojan(proxy) {
`,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`, `,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`,
'http-opts.headers.Host', 'http-opts.headers.Host',
); );
} else if (!['tcp'].includes(proxy.network)) { } else {
throw new Error(`network ${proxy.network} is unsupported`); throw new Error(`network ${proxy.network} is unsupported`);
} }
} }
@ -146,7 +148,9 @@ function vmess(proxy) {
result.append( result.append(
`${proxy.name}=vmess,${proxy.server},${proxy.port},${proxy.cipher},"${proxy.uuid}"`, `${proxy.name}=vmess,${proxy.server},${proxy.port},${proxy.cipher},"${proxy.uuid}"`,
); );
if (proxy.network === 'tcp') {
delete proxy.network;
}
// transport // transport
if (isPresent(proxy, 'network')) { if (isPresent(proxy, 'network')) {
if (proxy.network === 'ws') { if (proxy.network === 'ws') {
@ -171,7 +175,7 @@ function vmess(proxy) {
`,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`, `,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`,
'http-opts.headers.Host', 'http-opts.headers.Host',
); );
} else if (!['tcp'].includes(proxy.network)) { } else {
throw new Error(`network ${proxy.network} is unsupported`); throw new Error(`network ${proxy.network} is unsupported`);
} }
} else { } else {
@ -213,7 +217,9 @@ function vless(proxy) {
result.append( result.append(
`${proxy.name}=vless,${proxy.server},${proxy.port},"${proxy.uuid}"`, `${proxy.name}=vless,${proxy.server},${proxy.port},"${proxy.uuid}"`,
); );
if (proxy.network === 'tcp') {
delete proxy.network;
}
// transport // transport
if (isPresent(proxy, 'network')) { if (isPresent(proxy, 'network')) {
if (proxy.network === 'ws') { if (proxy.network === 'ws') {
@ -238,7 +244,7 @@ function vless(proxy) {
`,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`, `,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`,
'http-opts.headers.Host', 'http-opts.headers.Host',
); );
} else if (!['tcp'].includes(proxy.network)) { } else {
throw new Error(`network ${proxy.network} is unsupported`); throw new Error(`network ${proxy.network} is unsupported`);
} }
} else { } else {