Skip to content

Commit

Permalink
feat: 支持 Shadowrocket Shadowsocks 输入中的 Shadow TLS 参数
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Feb 20, 2025
1 parent 95d6688 commit 4a07c02
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.16.51",
"version": "2.16.52",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
Expand Down
21 changes: 21 additions & 0 deletions backend/src/core/proxy-utils/parsers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ function URI_SS() {

// handle obfs
const pluginMatch = content.match(/[?&]plugin=([^&]+)/);
const shadowTlsMatch = content.match(/[?&]shadow-tls=([^&]+)/);

if (pluginMatch) {
const pluginInfo = (
'plugin=' + decodeURIComponent(pluginMatch[1])
Expand Down Expand Up @@ -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)) {
proxy['udp-over-tcp'] = true;
}
Expand Down
3 changes: 3 additions & 0 deletions backend/src/core/proxy-utils/producers/clashmeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export default function ClashMeta_Producer() {
password: proxy['shadow-tls-password'],
version: proxy['shadow-tls-version'],
};
delete proxy['shadow-tls-password'];
delete proxy['shadow-tls-sni'];
delete proxy['shadow-tls-version'];
}
}

Expand Down

0 comments on commit 4a07c02

Please sign in to comment.