Skip to content

Commit b859327

Browse files
committed
splithttp to xhttp
1 parent 3e8fc59 commit b859327

File tree

7 files changed

+102
-102
lines changed

7 files changed

+102
-102
lines changed

sub/subService.go

+24-24
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,16 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string {
229229
headers, _ := httpupgrade["headers"].(map[string]interface{})
230230
obj["host"] = searchHost(headers)
231231
}
232-
case "splithttp":
233-
splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
234-
obj["path"] = splithttp["path"].(string)
235-
if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
232+
case "xhttp":
233+
xhttp, _ := stream["xhttpSettings"].(map[string]interface{})
234+
obj["path"] = xhttp["path"].(string)
235+
if host, ok := xhttp["host"].(string); ok && len(host) > 0 {
236236
obj["host"] = host
237237
} else {
238-
headers, _ := splithttp["headers"].(map[string]interface{})
238+
headers, _ := xhttp["headers"].(map[string]interface{})
239239
obj["host"] = searchHost(headers)
240240
}
241-
obj["mode"] = splithttp["mode"].(string)
241+
obj["mode"] = xhttp["mode"].(string)
242242
}
243243
security, _ := stream["security"].(string)
244244
obj["tls"] = security
@@ -381,16 +381,16 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
381381
headers, _ := httpupgrade["headers"].(map[string]interface{})
382382
params["host"] = searchHost(headers)
383383
}
384-
case "splithttp":
385-
splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
386-
params["path"] = splithttp["path"].(string)
387-
if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
384+
case "xhttp":
385+
xhttp, _ := stream["xhttpSettings"].(map[string]interface{})
386+
params["path"] = xhttp["path"].(string)
387+
if host, ok := xhttp["host"].(string); ok && len(host) > 0 {
388388
params["host"] = host
389389
} else {
390-
headers, _ := splithttp["headers"].(map[string]interface{})
390+
headers, _ := xhttp["headers"].(map[string]interface{})
391391
params["host"] = searchHost(headers)
392392
}
393-
params["mode"] = splithttp["mode"].(string)
393+
params["mode"] = xhttp["mode"].(string)
394394
}
395395
security, _ := stream["security"].(string)
396396
if security == "tls" {
@@ -579,16 +579,16 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
579579
headers, _ := httpupgrade["headers"].(map[string]interface{})
580580
params["host"] = searchHost(headers)
581581
}
582-
case "splithttp":
583-
splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
584-
params["path"] = splithttp["path"].(string)
585-
if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
582+
case "xhttp":
583+
xhttp, _ := stream["xhttpSettings"].(map[string]interface{})
584+
params["path"] = xhttp["path"].(string)
585+
if host, ok := xhttp["host"].(string); ok && len(host) > 0 {
586586
params["host"] = host
587587
} else {
588-
headers, _ := splithttp["headers"].(map[string]interface{})
588+
headers, _ := xhttp["headers"].(map[string]interface{})
589589
params["host"] = searchHost(headers)
590590
}
591-
params["mode"] = splithttp["mode"].(string)
591+
params["mode"] = xhttp["mode"].(string)
592592
}
593593
security, _ := stream["security"].(string)
594594
if security == "tls" {
@@ -777,16 +777,16 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st
777777
headers, _ := httpupgrade["headers"].(map[string]interface{})
778778
params["host"] = searchHost(headers)
779779
}
780-
case "splithttp":
781-
splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
782-
params["path"] = splithttp["path"].(string)
783-
if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
780+
case "xhttp":
781+
xhttp, _ := stream["xhttpSettings"].(map[string]interface{})
782+
params["path"] = xhttp["path"].(string)
783+
if host, ok := xhttp["host"].(string); ok && len(host) > 0 {
784784
params["host"] = host
785785
} else {
786-
headers, _ := splithttp["headers"].(map[string]interface{})
786+
headers, _ := xhttp["headers"].(map[string]interface{})
787787
params["host"] = searchHost(headers)
788788
}
789-
params["mode"] = splithttp["mode"].(string)
789+
params["mode"] = xhttp["mode"].(string)
790790
}
791791

792792
security, _ := stream["security"].(string)

web/assets/js/model/inbound.js

+34-34
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class HTTPUpgradeStreamSettings extends XrayCommonClass {
525525
}
526526
}
527527

528-
class SplitHTTPStreamSettings extends XrayCommonClass {
528+
class xHTTPStreamSettings extends XrayCommonClass {
529529
constructor(
530530
path = '/',
531531
host = '',
@@ -567,7 +567,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
567567
}
568568

569569
static fromJson(json = {}) {
570-
return new SplitHTTPStreamSettings(
570+
return new xHTTPStreamSettings(
571571
json.path,
572572
json.host,
573573
XrayCommonClass.toHeaders(json.headers),
@@ -961,7 +961,7 @@ class StreamSettings extends XrayCommonClass {
961961
httpSettings = new HttpStreamSettings(),
962962
grpcSettings = new GrpcStreamSettings(),
963963
httpupgradeSettings = new HTTPUpgradeStreamSettings(),
964-
splithttpSettings = new SplitHTTPStreamSettings(),
964+
xhttpSettings = new xHTTPStreamSettings(),
965965
sockopt = undefined,
966966
) {
967967
super();
@@ -976,7 +976,7 @@ class StreamSettings extends XrayCommonClass {
976976
this.http = httpSettings;
977977
this.grpc = grpcSettings;
978978
this.httpupgrade = httpupgradeSettings;
979-
this.splithttp = splithttpSettings;
979+
this.xhttp = xhttpSettings;
980980
this.sockopt = sockopt;
981981
}
982982

@@ -1026,7 +1026,7 @@ class StreamSettings extends XrayCommonClass {
10261026
HttpStreamSettings.fromJson(json.httpSettings),
10271027
GrpcStreamSettings.fromJson(json.grpcSettings),
10281028
HTTPUpgradeStreamSettings.fromJson(json.httpupgradeSettings),
1029-
SplitHTTPStreamSettings.fromJson(json.splithttpSettings),
1029+
xHTTPStreamSettings.fromJson(json.xhttpSettings),
10301030
SockoptStreamSettings.fromJson(json.sockopt),
10311031
);
10321032
}
@@ -1045,7 +1045,7 @@ class StreamSettings extends XrayCommonClass {
10451045
httpSettings: network === 'http' ? this.http.toJson() : undefined,
10461046
grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined,
10471047
httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined,
1048-
splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined,
1048+
xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined,
10491049
sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined,
10501050
};
10511051
}
@@ -1182,8 +1182,8 @@ class Inbound extends XrayCommonClass {
11821182
return this.network === "httpupgrade";
11831183
}
11841184

1185-
get isSplithttp() {
1186-
return this.network === "splithttp";
1185+
get isXHTTP() {
1186+
return this.network === "xhttp";
11871187
}
11881188

11891189
// Shadowsocks
@@ -1226,8 +1226,8 @@ class Inbound extends XrayCommonClass {
12261226
return this.stream.http.host[0];
12271227
} else if (this.isHttpupgrade) {
12281228
return this.stream.httpupgrade.host?.length > 0 ? this.stream.httpupgrade.host : this.getHeader(this.stream.httpupgrade, 'host');
1229-
} else if (this.isSplithttp) {
1230-
return this.stream.splithttp.host?.length > 0 ? this.stream.splithttp.host : this.getHeader(this.stream.splithttp, 'host');
1229+
} else if (this.isXHTTP) {
1230+
return this.stream.xhttp.host?.length > 0 ? this.stream.xhttp.host : this.getHeader(this.stream.xhttp, 'host');
12311231
}
12321232
return null;
12331233
}
@@ -1241,8 +1241,8 @@ class Inbound extends XrayCommonClass {
12411241
return this.stream.http.path;
12421242
} else if (this.isHttpupgrade) {
12431243
return this.stream.httpupgrade.path;
1244-
} else if (this.isSplithttp) {
1245-
return this.stream.splithttp.path;
1244+
} else if (this.isXHTTP) {
1245+
return this.stream.xhttp.path;
12461246
}
12471247
return null;
12481248
}
@@ -1266,7 +1266,7 @@ class Inbound extends XrayCommonClass {
12661266

12671267
canEnableTls() {
12681268
if (![Protocols.VMESS, Protocols.VLESS, Protocols.TROJAN, Protocols.SHADOWSOCKS].includes(this.protocol)) return false;
1269-
return ["tcp", "ws", "http", "grpc", "httpupgrade", "splithttp"].includes(this.network);
1269+
return ["tcp", "ws", "http", "grpc", "httpupgrade", "xhttp"].includes(this.network);
12701270
}
12711271

12721272
//this is used for xtls-rprx-vision
@@ -1279,7 +1279,7 @@ class Inbound extends XrayCommonClass {
12791279

12801280
canEnableReality() {
12811281
if (![Protocols.VLESS, Protocols.TROJAN].includes(this.protocol)) return false;
1282-
return ["tcp", "http", "grpc", "splithttp"].includes(this.network);
1282+
return ["tcp", "http", "grpc", "xhttp"].includes(this.network);
12831283
}
12841284

12851285
canEnableStream() {
@@ -1345,11 +1345,11 @@ class Inbound extends XrayCommonClass {
13451345
const httpupgrade = this.stream.httpupgrade;
13461346
obj.path = httpupgrade.path;
13471347
obj.host = httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host');
1348-
} else if (network === 'splithttp') {
1349-
const splithttp = this.stream.splithttp;
1350-
obj.path = splithttp.path;
1351-
obj.host = splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host');
1352-
obj.mode = splithttp.mode;
1348+
} else if (network === 'xhttp') {
1349+
const xhttp = this.stream.xhttp;
1350+
obj.path = xhttp.path;
1351+
obj.host = xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host');
1352+
obj.mode = xhttp.mode;
13531353
}
13541354

13551355
if (security === 'tls') {
@@ -1418,11 +1418,11 @@ class Inbound extends XrayCommonClass {
14181418
params.set("path", httpupgrade.path);
14191419
params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host'));
14201420
break;
1421-
case "splithttp":
1422-
const splithttp = this.stream.splithttp;
1423-
params.set("path", splithttp.path);
1424-
params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'));
1425-
params.set("mode", splithttp.mode);
1421+
case "xhttp":
1422+
const xhttp = this.stream.xhttp;
1423+
params.set("path", xhttp.path);
1424+
params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host'));
1425+
params.set("mode", xhttp.mode);
14261426
break;
14271427
}
14281428

@@ -1522,11 +1522,11 @@ class Inbound extends XrayCommonClass {
15221522
params.set("path", httpupgrade.path);
15231523
params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host'));
15241524
break;
1525-
case "splithttp":
1526-
const splithttp = this.stream.splithttp;
1527-
params.set("path", splithttp.path);
1528-
params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'));
1529-
params.set("mode", splithttp.mode);
1525+
case "xhttp":
1526+
const xhttp = this.stream.xhttp;
1527+
params.set("path", xhttp.path);
1528+
params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host'));
1529+
params.set("mode", xhttp.mode);
15301530
break;
15311531
}
15321532

@@ -1605,11 +1605,11 @@ class Inbound extends XrayCommonClass {
16051605
params.set("path", httpupgrade.path);
16061606
params.set("host", httpupgrade.host?.length > 0 ? httpupgrade.host : this.getHeader(httpupgrade, 'host'));
16071607
break;
1608-
case "splithttp":
1609-
const splithttp = this.stream.splithttp;
1610-
params.set("path", splithttp.path);
1611-
params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'));
1612-
params.set("mode", splithttp.mode);
1608+
case "xhttp":
1609+
const xhttp = this.stream.xhttp;
1610+
params.set("path", xhttp.path);
1611+
params.set("host", xhttp.host?.length > 0 ? xhttp.host : this.getHeader(xhttp, 'host'));
1612+
params.set("mode", xhttp.mode);
16131613
break;
16141614
}
16151615

web/assets/js/model/outbound.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class HttpUpgradeStreamSettings extends CommonClass {
335335
}
336336
}
337337

338-
class SplitHTTPStreamSettings extends CommonClass {
338+
class xHTTPStreamSettings extends CommonClass {
339339
constructor(
340340
path = '/',
341341
host = '',
@@ -348,7 +348,7 @@ class SplitHTTPStreamSettings extends CommonClass {
348348
}
349349

350350
static fromJson(json = {}) {
351-
return new SplitHTTPStreamSettings(
351+
return new xHTTPStreamSettings(
352352
json.path,
353353
json.host,
354354
json.mode,
@@ -482,7 +482,7 @@ class StreamSettings extends CommonClass {
482482
quicSettings = new QuicStreamSettings(),
483483
grpcSettings = new GrpcStreamSettings(),
484484
httpupgradeSettings = new HttpUpgradeStreamSettings(),
485-
splithttpSettings = new SplitHTTPStreamSettings(),
485+
xhttpSettings = new xHTTPStreamSettings(),
486486
sockopt = undefined,
487487
) {
488488
super();
@@ -496,7 +496,7 @@ class StreamSettings extends CommonClass {
496496
this.http = httpSettings;
497497
this.grpc = grpcSettings;
498498
this.httpupgrade = httpupgradeSettings;
499-
this.splithttp = splithttpSettings;
499+
this.xhttp = xhttpSettings;
500500
this.sockopt = sockopt;
501501
}
502502

@@ -529,7 +529,7 @@ class StreamSettings extends CommonClass {
529529
QuicStreamSettings.fromJson(json.quicSettings),
530530
GrpcStreamSettings.fromJson(json.grpcSettings),
531531
HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings),
532-
SplitHTTPStreamSettings.fromJson(json.splithttpSettings),
532+
xHTTPStreamSettings.fromJson(json.xhttpSettings),
533533
SockoptStreamSettings.fromJson(json.sockopt),
534534
);
535535
}
@@ -547,7 +547,7 @@ class StreamSettings extends CommonClass {
547547
httpSettings: network === 'http' ? this.http.toJson() : undefined,
548548
grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined,
549549
httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined,
550-
splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined,
550+
xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined,
551551
sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined,
552552
};
553553
}
@@ -612,7 +612,7 @@ class Outbound extends CommonClass {
612612

613613
canEnableTls() {
614614
if (![Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(this.protocol)) return false;
615-
return ["tcp", "ws", "http", "grpc", "httpupgrade", "splithttp"].includes(this.stream.network);
615+
return ["tcp", "ws", "http", "grpc", "httpupgrade", "xhttp"].includes(this.stream.network);
616616
}
617617

618618
//this is used for xtls-rprx-vision
@@ -625,7 +625,7 @@ class Outbound extends CommonClass {
625625

626626
canEnableReality() {
627627
if (![Protocols.VLESS, Protocols.Trojan].includes(this.protocol)) return false;
628-
return ["tcp", "http", "grpc", "splithttp"].includes(this.stream.network);
628+
return ["tcp", "http", "grpc", "xhttp"].includes(this.stream.network);
629629
}
630630

631631
canEnableStream() {
@@ -732,8 +732,8 @@ class Outbound extends CommonClass {
732732
stream.grpc = new GrpcStreamSettings(json.path, json.authority, json.type == 'multi');
733733
} else if (network === 'httpupgrade') {
734734
stream.httpupgrade = new HttpUpgradeStreamSettings(json.path, json.host);
735-
} else if (network === 'splithttp') {
736-
stream.splithttp = new SplitHTTPStreamSettings(json.path, json.host, json.mode);
735+
} else if (network === 'xhttp') {
736+
stream.xhttp = new xHTTPStreamSettings(json.path, json.host, json.mode);
737737
}
738738

739739
if (json.tls && json.tls == 'tls') {
@@ -776,8 +776,8 @@ class Outbound extends CommonClass {
776776
url.searchParams.get('mode') == 'multi');
777777
} else if (type === 'httpupgrade') {
778778
stream.httpupgrade = new HttpUpgradeStreamSettings(path, host);
779-
} else if (type === 'splithttp') {
780-
stream.splithttp = new SplitHTTPStreamSettings(path, host, mode);
779+
} else if (type === 'xhttp') {
780+
stream.xhttp = new xHTTPStreamSettings(path, host, mode);
781781
}
782782

783783
if (security == 'tls') {

web/html/xui/form/outbound.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
<a-select-option value="http">HTTP</a-select-option>
274274
<a-select-option value="grpc">gRPC</a-select-option>
275275
<a-select-option value="httpupgrade">HTTPUpgrade</a-select-option>
276-
<a-select-option value="splithttp">SplitHTTP (XHTTP)</a-select-option>
276+
<a-select-option value="xhttp">XHTTP</a-select-option>
277277
</a-select>
278278
</a-form-item>
279279
<template v-if="outbound.stream.network === 'tcp'">
@@ -375,16 +375,16 @@
375375
</a-form-item>
376376
</template>
377377

378-
<!-- splithttp -->
379-
<template v-if="outbound.stream.network === 'splithttp'">
378+
<!-- xhttp -->
379+
<template v-if="outbound.stream.network === 'xhttp'">
380380
<a-form-item label='{{ i18n "host" }}'>
381-
<a-input v-model="outbound.stream.splithttp.host"></a-input>
381+
<a-input v-model="outbound.stream.xhttp.host"></a-input>
382382
</a-form-item>
383383
<a-form-item label='{{ i18n "path" }}'>
384-
<a-input v-model.trim="outbound.stream.splithttp.path"></a-input>
384+
<a-input v-model.trim="outbound.stream.xhttp.path"></a-input>
385385
</a-form-item>
386386
<a-form-item label='Mode'>
387-
<a-select v-model="outbound.stream.splithttp.mode" :dropdown-class-name="themeSwitcher.currentTheme">
387+
<a-select v-model="outbound.stream.xhttp.mode" :dropdown-class-name="themeSwitcher.currentTheme">
388388
<a-select-option v-for="key in MODE_OPTION" :value="key">[[ key ]]</a-select-option>
389389
</a-select>
390390
</a-form-item>

0 commit comments

Comments
 (0)