Skip to content

Commit

Permalink
SplitHTTP xmux maxConnections maxConcurrency 二选一不能都配置
Browse files Browse the repository at this point in the history
  • Loading branch information
qist committed Sep 19, 2024
1 parent 02a520d commit e738660
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 18 deletions.
28 changes: 16 additions & 12 deletions web/assets/js/model/xray.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,11 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
scMinPostsIntervalMs = 30,
noSSEHeader = false,
xPaddingBytes = "100-1000",
xmux = {
maxConnections: 0,
maxConcurrency: 0,
cMaxReuseTimes: 0,
cMaxLifetimeMs: 0
xmux = {
maxConnections: '',
maxConcurrency: '',
cMaxReuseTimes: 0,
cMaxLifetimeMs: 0
}
) {
super();
Expand All @@ -540,7 +540,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
this.scMinPostsIntervalMs = scMinPostsIntervalMs;
this.noSSEHeader = noSSEHeader;
this.xPaddingBytes = RandomUtil.convertXPaddingBytes(xPaddingBytes);
this.xmux = xmux;
this.xmux = xmux;
}

addHeader(name, value) {
Expand Down Expand Up @@ -573,6 +573,15 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
}

toJson() {
const xmuxData = {};
if (!ObjectUtil.isEmpty(this.xmux.maxConnections)) {
xmuxData.maxConnections = RandomUtil.convertXPaddingBytes(this.xmux.maxConnections);
}
if (!ObjectUtil.isEmpty(this.xmux.maxConcurrency)) {
xmuxData.maxConcurrency = RandomUtil.convertXPaddingBytes(this.xmux.maxConcurrency);
}
xmuxData.cMaxReuseTimes = RandomUtil.convertXPaddingBytes(this.xmux.cMaxReuseTimes);
xmuxData.cMaxLifetimeMs = RandomUtil.convertXPaddingBytes(this.xmux.cMaxLifetimeMs);
return {
path: this.path,
host: this.host,
Expand All @@ -582,12 +591,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
scMinPostsIntervalMs: this.scMinPostsIntervalMs,
noSSEHeader: this.noSSEHeader,
xPaddingBytes: RandomUtil.convertXPaddingBytes(this.xPaddingBytes),
xmux: {
maxConnections: this.xmux.maxConnections,
maxConcurrency: this.xmux.maxConcurrency,
cMaxReuseTimes: this.xmux.cMaxReuseTimes,
cMaxLifetimeMs: this.xmux.cMaxLifetimeMs
}
xmux: xmuxData,
};
}
}
Expand Down
37 changes: 31 additions & 6 deletions web/html/xui/form/stream/stream_splithttp.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,42 @@
</span>
<a-input v-model.trim="inbound.stream.splithttp.xPaddingBytes" style="width: 100px"></a-input>
</a-form-item>
<a-form-item label="Max Connections">
<a-input-number v-model.trim="inbound.stream.splithttp.xmux.maxConnections" :min="0"></a-input-number>

<a-form-item>
<span slot="label">
Max Connections
<a-tooltip>
<template slot="title">
maxConnections: 默认值为空 为0(即无限) 要打开的最大连接数,连接达到此值前核心会积极打开连接,对每一条流都新建一个连接,直到达到该值。
然后核心会开始复用已经建立的连接。 与 maxConcurrency 冲突。
所有字段类型均为 int/string 均支持固定值 16 或浮动值 "8-32" 的写法
</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-form-item>
<a-form-item label="Max Concurrency">
<a-input-number v-model.trim="inbound.stream.splithttp.xmux.maxConcurrency" :min="0"></a-input-number>

<a-form-item>
<span slot="label">
Max Concurrency
<a-tooltip>
<template slot="title">
maxConcurrency: 默认值为空 为0(即无限) 每个连接中复用的流的最大数量,连接中流的数量达到该值后核心会新建更多连接以容纳更多的流,
类似于 mux.cool 的 concurrency. 与 maxConnections 冲突。
所有字段类型均为 int/string 均支持固定值 16 或浮动值 "8-32" 的写法
</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-form-item>

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

0 comments on commit e738660

Please sign in to comment.