feat: 支持 Shadowrocket Shadowsocks 输入中的 Shadow TLS 参数

This commit is contained in:
xream 2025-02-21 01:44:34 +08:00
parent 95d6688539
commit 4a07c02dc1
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
3 changed files with 25 additions and 1 deletions

View File

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

@ -190,6 +190,8 @@ function URI_SS() {
// handle obfs // handle obfs
const pluginMatch = content.match(/[?&]plugin=([^&]+)/); const pluginMatch = content.match(/[?&]plugin=([^&]+)/);
const shadowTlsMatch = content.match(/[?&]shadow-tls=([^&]+)/);
if (pluginMatch) { if (pluginMatch) {
const pluginInfo = ( const pluginInfo = (
'plugin=' + decodeURIComponent(pluginMatch[1]) 'plugin=' + decodeURIComponent(pluginMatch[1])
@ -233,6 +235,25 @@ function URI_SS() {
); );
} }
} }
// Shadowrocket
if (shadowTlsMatch) {
const params = JSON.parse(Base64.decode(shadowTlsMatch[1]));
const version = getIfNotBlank(params['version']);
const address = getIfNotBlank(params['address']);
const port = getIfNotBlank(params['port']);
proxy.plugin = 'shadow-tls';
proxy['plugin-opts'] = {
host: getIfNotBlank(params['host']),
password: getIfNotBlank(params['password']),
version: version ? parseInt(version, 10) : undefined,
};
if (address) {
proxy.server = address;
}
if (port) {
proxy.port = parseInt(port, 10);
}
}
if (/(&|\?)uot=(1|true)/i.test(query)) { if (/(&|\?)uot=(1|true)/i.test(query)) {
proxy['udp-over-tcp'] = true; proxy['udp-over-tcp'] = true;
} }

View File

@ -105,6 +105,9 @@ export default function ClashMeta_Producer() {
password: proxy['shadow-tls-password'], password: proxy['shadow-tls-password'],
version: proxy['shadow-tls-version'], version: proxy['shadow-tls-version'],
}; };
delete proxy['shadow-tls-password'];
delete proxy['shadow-tls-sni'];
delete proxy['shadow-tls-version'];
} }
} }