Skip to content

Commit

Permalink
feat: VMess URI 支持 TCP/H2 传输层
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jun 3, 2024
1 parent 8cd0545 commit c5a417d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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.14.332",
"version": "2.14.333",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
11 changes: 9 additions & 2 deletions backend/src/core/proxy-utils/parsers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,9 @@ function URI_VMess() {
if (params.net === 'ws' || params.obfs === 'websocket') {
proxy.network = 'ws';
} else if (
['tcp', 'http'].includes(params.net) ||
params.obfs === 'http'
['http'].includes(params.net) ||
['http'].includes(params.obfs) ||
['http'].includes(params.type)
) {
proxy.network = 'http';
} else if (['grpc'].includes(params.net)) {
Expand All @@ -317,6 +318,8 @@ function URI_VMess() {
) {
proxy.network = 'ws';
httpupgrade = true;
} else if (params.net === 'h2' || proxy.network === 'h2') {
proxy.network = 'h2';
}
if (proxy.network) {
let transportHost = params.host ?? params.obfsParam;
Expand All @@ -332,6 +335,10 @@ function URI_VMess() {

if (proxy.network === 'http') {
if (transportHost) {
// 1)http(tcp)->host中间逗号(,)隔开
transportHost = transportHost
.split(',')
.map((i) => i.trim());
transportHost = Array.isArray(transportHost)
? transportHost[0]
: transportHost;
Expand Down

0 comments on commit c5a417d

Please sign in to comment.