Skip to content

Commit

Permalink
remove splithttp to xhttp
Browse files Browse the repository at this point in the history
qist committed Dec 10, 2024
1 parent d40e2ea commit f50a711
Showing 6 changed files with 84 additions and 83 deletions.
2 changes: 1 addition & 1 deletion config/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.12.02
24.12.10
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ require (
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/robfig/cron/v3 v3.0.1
github.com/shirou/gopsutil/v3 v3.24.5
github.com/xtls/xray-core v1.8.25-0.20241201231301-03d7d07c5b77
github.com/xtls/xray-core v1.8.25-0.20241207144338-9cb6816383dd
go.uber.org/atomic v1.11.0
golang.org/x/crypto v0.30.0
golang.org/x/text v0.21.0
@@ -57,7 +57,7 @@ require (
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sys v0.28.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/protobuf v1.35.2 // indirect
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -164,8 +164,8 @@ github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1Y
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d h1:+B97uD9uHLgAAulhigmys4BVwZZypzK7gPN3WtpgRJg=
github.com/xtls/reality v0.0.0-20240712055506-48f0b2d5ed6d/go.mod h1:dm4y/1QwzjGaK17ofi0Vs6NpKAHegZky8qk6J2JJZAE=
github.com/xtls/xray-core v1.8.25-0.20241201231301-03d7d07c5b77 h1:4s1Q/Wb7Iwuzwgkoe1d48hSmexwlUOn+XJQ7sOuWSDQ=
github.com/xtls/xray-core v1.8.25-0.20241201231301-03d7d07c5b77/go.mod h1:BCeSy6P4xz8vSk46ziVkg0iby82W2Mmqvz2ub5kfYrc=
github.com/xtls/xray-core v1.8.25-0.20241207144338-9cb6816383dd h1:jcGpaTPQUgFqCeG2Ek5Yj1fwVsoI4LcIDJNXuC2qMaA=
github.com/xtls/xray-core v1.8.25-0.20241207144338-9cb6816383dd/go.mod h1:jTHrem03qe2KEk7RttKZbHk0VdJDf0CWQ9B+/2FXNI0=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
@@ -191,8 +191,8 @@ golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
99 changes: 50 additions & 49 deletions web/assets/js/model/xray.js
Original file line number Diff line number Diff line change
@@ -117,6 +117,7 @@ const MODE_OPTION = {
AUTO: "auto",
PACKET_UP: "packet-up",
STREAM_UP: "stream-up",
STREAM_ONE: "stream-one",
};

Object.freeze(Protocols);
@@ -521,7 +522,7 @@ class HttpUpgradeStreamSettings extends XrayCommonClass {
}
}

class SplitHTTPStreamSettings extends XrayCommonClass {
class xHTTPStreamSettings extends XrayCommonClass {
constructor(
path = '/',
host = '',
@@ -532,9 +533,9 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
noSSEHeader = false,
xPaddingBytes = "100-1000",
xmux = {
maxConnections: '',
maxConcurrency: '',
cMaxReuseTimes: 0,
maxConnections: '16-32',
maxConcurrency: 0,
cMaxReuseTimes: '64-128',
cMaxLifetimeMs: 0
},
mode = MODE_OPTION.AUTO,
@@ -570,7 +571,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
}

static fromJson(json = {}) {
return new SplitHTTPStreamSettings(
return new xHTTPStreamSettings(
json.path,
json.host,
XrayCommonClass.toHeaders(json.headers),
@@ -908,7 +909,7 @@ class StreamSettings extends XrayCommonClass {
httpSettings = new HttpStreamSettings(),
grpcSettings = new GrpcStreamSettings(),
httpupgradeSettings = new HttpUpgradeStreamSettings(),
splithttpSettings = new SplitHTTPStreamSettings(),
xhttpSettings = new xHTTPStreamSettings(),
sockopt = undefined,
) {
super();
@@ -923,7 +924,7 @@ class StreamSettings extends XrayCommonClass {
this.http = httpSettings;
this.grpc = grpcSettings;
this.httpupgrade = httpupgradeSettings;
this.splithttp = splithttpSettings;
this.xhttp = xhttpSettings;
this.sockopt = sockopt;
}

@@ -972,7 +973,7 @@ class StreamSettings extends XrayCommonClass {
HttpStreamSettings.fromJson(json.httpSettings),
GrpcStreamSettings.fromJson(json.grpcSettings),
HttpUpgradeStreamSettings.fromJson(json.httpupgradeSettings),
SplitHTTPStreamSettings.fromJson(json.splithttpSettings),
xHTTPStreamSettings.fromJson(json.xhttpSettings),
SockoptStreamSettings.fromJson(json.sockopt),
);
}
@@ -991,7 +992,7 @@ class StreamSettings extends XrayCommonClass {
httpSettings: network === 'http' ? this.http.toJson() : undefined,
grpcSettings: network === 'grpc' ? this.grpc.toJson() : undefined,
httpupgradeSettings: network === 'httpupgrade' ? this.httpupgrade.toJson() : undefined,
splithttpSettings: network === 'splithttp' ? this.splithttp.toJson() : undefined,
xhttpSettings: network === 'xhttp' ? this.xhttp.toJson() : undefined,
sockopt: this.sockopt != undefined ? this.sockopt.toJson() : undefined,
};
}
@@ -1109,8 +1110,8 @@ class Inbound extends XrayCommonClass {
get isHttpupgrade() {
return this.network === "httpupgrade";
}
get isSplithttp() {
return this.network === "splithttp";
get isXHTTP() {
return this.network === "xhttp";
}
// VMess & VLess
get uuid() {
@@ -1190,8 +1191,8 @@ class Inbound extends XrayCommonClass {
return this.stream.http.host[0];
} else if (this.isHttpupgrade) {
return this.stream.httpupgrade.host;
} else if (this.isSplithttp) {
return this.stream.splithttp.host;
} else if (this.isXHTTP) {
return this.stream.xhttp.host;
}
return null;
}
@@ -1207,8 +1208,8 @@ class Inbound extends XrayCommonClass {
return this.stream.http.path[0];
} else if (this.isHttpupgrade) {
return this.stream.httpupgrade.path;
} else if (this.isSplithttp) {
return this.stream.splithttp.path;
} else if (this.isXHTTP) {
return this.stream.xhttp.path;
}
return null;
}
@@ -1243,7 +1244,7 @@ class Inbound extends XrayCommonClass {
case "http":
case "grpc":
case "httpupgrade":
case "splithttp":
case "xhttp":
return true;
default:
return false;
@@ -1262,7 +1263,7 @@ class Inbound extends XrayCommonClass {
default:
return false;
}
return ['tcp', 'raw', 'http', 'grpc', 'httpupgrade', 'splithttp'].indexOf(this.network) !== -1;
return ['tcp', 'raw', 'http', 'grpc', 'httpupgrade', 'xhttp'].indexOf(this.network) !== -1;
//return this.network === "tcp";
}

@@ -1376,15 +1377,15 @@ class Inbound extends XrayCommonClass {
if (index >= 0) {
host = httpupgrade.headers[index].value;
}
} else if (network === 'splithttp') {
const splithttp = this.stream.splithttp;
path = splithttp.path;
host = splithttp.host;
let index = splithttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
} else if (network === 'xhttp') {
const xhttp = this.stream.xhttp;
path = xhttp.path;
host = xhttp.host;
let index = xhttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (index >= 0) {
host = splithttp.headers[index].value;
host = xhttp.headers[index].value;
};
mode = splithttp.mode;
mode = xhttp.mode;
}

if (this.stream.security === 'tls') {
@@ -1406,7 +1407,7 @@ class Inbound extends XrayCommonClass {
type: type,
host: host,
path: path,
...(network === 'splithttp' && { mode: mode }),
...(network === 'xhttp' && { mode: mode }),
authority: authority,
tls: this.stream.security,
sni: sni,
@@ -1489,16 +1490,16 @@ class Inbound extends XrayCommonClass {
params.set("host", host);
}
break;
case "splithttp":
const splithttp = this.stream.splithttp;
params.set("path", splithttp.path);
params.set("host", splithttp.host);
const splithttpIndex = splithttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (splithttpIndex >= 0) {
const host = splithttp.headers[splithttpIndex].value;
case "xhttp":
const xhttp = this.stream.xhttp;
params.set("path", xhttp.path);
params.set("host", xhttp.host);
const xhttpIndex = xhttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (xhttpIndex >= 0) {
const host = xhttp.headers[xhttpIndex].value;
params.set("host", host);
};
params.set("mode", splithttp.mode);
params.set("mode", xhttp.mode);
break;
}

@@ -1627,16 +1628,16 @@ class Inbound extends XrayCommonClass {
params.set("host", host);
}
break;
case "splithttp":
const splithttp = this.stream.splithttp;
params.set("path", splithttp.path);
params.set("host", splithttp.host);
const splithttpIndex = splithttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (splithttpIndex >= 0) {
const host = splithttp.headers[splithttpIndex].value;
case "xhttp":
const xhttp = this.stream.xhttp;
params.set("path", xhttp.path);
params.set("host", xhttp.host);
const xhttpIndex = xhttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (xhttpIndex >= 0) {
const host = xhttp.headers[xhttpIndex].value;
params.set("host", host);
};
params.set("mode", splithttp.mode);
params.set("mode", xhttp.mode);
break;
}

@@ -1750,16 +1751,16 @@ class Inbound extends XrayCommonClass {
params.set("host", host);
}
break;
case "splithttp":
const splithttp = this.stream.splithttp;
params.set("path", splithttp.path);
params.set("host", splithttp.host);
const splithttpIndex = splithttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (splithttpIndex >= 0) {
const host = splithttp.headers[splithttpIndex].value;
case "xhttp":
const xhttp = this.stream.xhttp;
params.set("path", xhttp.path);
params.set("host", xhttp.host);
const xhttpIndex = xhttp.headers.findIndex(header => header.name.toLowerCase() === 'host');
if (xhttpIndex >= 0) {
const host = xhttp.headers[xhttpIndex].value;
params.set("host", host);
};
params.set("mode", splithttp.mode);
params.set("mode", xhttp.mode);
break;
}

8 changes: 4 additions & 4 deletions web/html/xui/form/stream/stream_settings.html
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
<a-select-option value="http">http</a-select-option>
<a-select-option value="grpc">grpc</a-select-option>
<a-select-option value="httpupgrade">HTTPUpgrade</a-select-option>
<a-select-option value="splithttp">SplitHTTP</a-select-option>
<a-select-option value="xhttp">xHTTP</a-select-option>
</a-select>
</a-form-item>
</a-form>
@@ -50,9 +50,9 @@
{{template "form/streamHTTPUpgrade"}}
</template>

<!-- splithttp -->
<template v-if="inbound.stream.network === 'splithttp'">
{{template "form/streamSplitHTTP"}}
<!-- xhttp -->
<template v-if="inbound.stream.network === 'xhttp'">
{{template "form/streamXHTTP"}}
</template>
<!-- sockopt -->
<template>
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{{define "form/streamSplitHTTP"}}
{{define "form/streamXHTTP"}}
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
<a-form-item label='host'>
<a-input v-model.trim="inbound.stream.splithttp.host"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.host"></a-input>
</a-form-item>
<a-form-item label='path'>
<a-input v-model.trim="inbound.stream.splithttp.path"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.path"></a-input>
</a-form-item>
<a-form-item label="请求头">
<a-row>
<a-button size="small" @click="inbound.stream.splithttp.addHeader('Host', '')">
<a-button size="small" @click="inbound.stream.xhttp.addHeader('Host', '')">
+
</a-button>
</a-row>
<a-input-group v-for="(header, index) in inbound.stream.splithttp.headers">
<a-input-group v-for="(header, index) in inbound.stream.xhttp.headers">
<a-input style="width: 50%" v-model.trim="header.name" addon-before="名称"></a-input>
<a-input style="width: 50%" v-model.trim="header.value" addon-before="">
<template slot="addonAfter">
<a-button size="small" @click="inbound.stream.splithttp.removeHeader(index)">
<a-button size="small" @click="inbound.stream.xhttp.removeHeader(index)">
-
</a-button>
</template>
</a-input>
</a-input-group>
</a-form-item>
<a-form-item label="Mode">
<a-select v-model="inbound.stream.splithttp.mode" style="width: 50%">
<a-select v-model="inbound.stream.xhttp.mode" style="width: 50%">
<a-select-option v-for="key in MODE_OPTION" :value="key">[[ key ]]</a-select-option>
</a-se-chlect>
</a-form-item>
<a-form-item label="Max Concurrent Upload">
<a-input-number v-model="inbound.stream.splithttp.scMaxConcurrentPosts" :min="0"></a-input-number>
<a-input-number v-model="inbound.stream.xhttp.scMaxConcurrentPosts" :min="0"></a-input-number>
</a-form-item>
<a-form-item label="Max Upload Size (Byte)">
<a-input-number v-model="inbound.stream.splithttp.scMaxEachPostBytes" :min="0"></a-input-number>
<a-input-number v-model="inbound.stream.xhttp.scMaxEachPostBytes" :min="0"></a-input-number>
</a-form-item>
<a-form-item label="Min Upload Interval (Ms)">
<a-input-number v-model="inbound.stream.splithttp.scMinPostsIntervalMs" :min="0"></a-input-number>
<a-input-number v-model="inbound.stream.xhttp.scMinPostsIntervalMs" :min="0"></a-input-number>
</a-form-item>
<a-form-item label="No SSE Header">
<a-switch v-model="inbound.stream.splithttp.noSSEHeader"></a-switch>
<a-switch v-model="inbound.stream.xhttp.noSSEHeader"></a-switch>
</a-form-item>
<a-form-item>
<span slot="label">
@@ -51,47 +51,47 @@
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
</span>
<a-input v-model.trim="inbound.stream.splithttp.xPaddingBytes" style="width: 100px"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.xPaddingBytes" style="width: 100px"></a-input>
</a-form-item>

<a-form-item>
<a-form-item v-if="!inbound.stream.xhttp.xmux.maxConcurrency">
<span slot="label">
Max Connections
Max Connections
<a-tooltip>
<template slot="title">
maxConnections: 默认值为空 为0(即无限) 要打开的最大连接数,连接达到此值前核心会积极打开连接,对每一条流都新建一个连接,直到达到该值。
然后核心会开始复用已经建立的连接。 与 maxConcurrency 冲突。
所有字段类型均为 int/string 均支持固定值 16 或浮动值 "8-32" 的写法
所有字段类型均为 int/string 均支持固定值 16 或浮动值 "8-32" 的写法 [删除里面内容可选择maxConcurrency]
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
</span>
<a-input v-model.trim="inbound.stream.splithttp.xmux.maxConnections" style="width: 100px"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.xmux.maxConnections" style="width: 100px"></a-input>
</a-form-item>

<a-form-item>
<a-form-item v-if="!inbound.stream.xhttp.xmux.maxConnections">
<span slot="label">
Max Concurrency
Max Concurrency
<a-tooltip>
<template slot="title">
maxConcurrency: 默认值为空 为0(即无限) 每个连接中复用的流的最大数量,连接中流的数量达到该值后核心会新建更多连接以容纳更多的流,
类似于 mux.cool 的 concurrency. 与 maxConnections 冲突。
所有字段类型均为 int/string 均支持固定值 16 或浮动值 "8-32" 的写法
所有字段类型均为 int/string 均支持固定值 16 或浮动值 "8-32" 的写法 [删除里面内容可选择maxConnections]
</template>
<a-icon type="question-circle" theme="filled"></a-icon>
</a-tooltip>
</span>
<a-input v-model.trim="inbound.stream.splithttp.xmux.maxConcurrency" style="width: 100px"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.xmux.maxConcurrency" style="width: 100px"></a-input>
</a-form-item>

<a-form-item label="Max Reuse Times">
<a-input v-model.trim="inbound.stream.splithttp.xmux.cMaxReuseTimes" style="width: 100px"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.xmux.cMaxReuseTimes" style="width: 100px"></a-input>
</a-form-item>
<a-form-item label="Max Lifetime (ms)">
<a-input v-model.trim="inbound.stream.splithttp.xmux.cMaxLifetimeMs" style="width: 100px"></a-input>
<a-input v-model.trim="inbound.stream.xhttp.xmux.cMaxLifetimeMs" style="width: 100px"></a-input>
</a-form-item>
<a-form-item label="No gRPC Header">
<a-switch v-model="inbound.stream.splithttp.noGRPCHeader"></a-switch>
<a-switch v-model="inbound.stream.xhttp.noGRPCHeader"></a-switch>
</a-form-item>
</a-form>
{{end}}

0 comments on commit f50a711

Please sign in to comment.