SplitHTTP - Mode

This commit is contained in:
mhsanaei
2024-11-14 13:09:51 +03:30
parent 2982d809ab
commit ccda652e69
6 changed files with 57 additions and 5 deletions

View File

@@ -113,6 +113,12 @@ const USERS_SECURITY = {
ZERO: "zero",
};
const MODE_OPTION = {
AUTO: "auto",
PACKET_UP: "packet-up",
STREAM_UP: "stream-up",
};
Object.freeze(Protocols);
Object.freeze(SSMethods);
Object.freeze(TLS_FLOW_CONTROL);
@@ -125,6 +131,7 @@ Object.freeze(USAGE_OPTION);
Object.freeze(DOMAIN_STRATEGY_OPTION);
Object.freeze(TCP_CONGESTION_OPTION);
Object.freeze(USERS_SECURITY);
Object.freeze(MODE_OPTION);
class XrayCommonClass {
@@ -528,7 +535,8 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
maxConnections: 0,
cMaxReuseTimes: "64-128",
cMaxLifetimeMs: 0
}
},
mode = MODE_OPTION.AUTO,
) {
super();
this.path = path;
@@ -540,6 +548,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
this.noSSEHeader = noSSEHeader;
this.xPaddingBytes = xPaddingBytes;
this.xmux = xmux;
this.mode = mode;
}
addHeader(name, value) {
@@ -561,6 +570,7 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
json.noSSEHeader,
json.xPaddingBytes,
json.xmux,
json.mode,
);
}
@@ -579,7 +589,8 @@ class SplitHTTPStreamSettings extends XrayCommonClass {
maxConnections: this.xmux.maxConnections,
cMaxReuseTimes: this.xmux.cMaxReuseTimes,
cMaxLifetimeMs: this.xmux.cMaxLifetimeMs
}
},
mode: this.mode,
};
}
}
@@ -1329,6 +1340,7 @@ class Inbound extends XrayCommonClass {
const splithttp = this.stream.splithttp;
obj.path = splithttp.path;
obj.host = splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host');
obj.mode = splithttp.mode;
}
if (security === 'tls') {
@@ -1401,6 +1413,7 @@ class Inbound extends XrayCommonClass {
const splithttp = this.stream.splithttp;
params.set("path", splithttp.path);
params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'));
params.set("mode", splithttp.mode);
break;
}
@@ -1504,6 +1517,7 @@ class Inbound extends XrayCommonClass {
const splithttp = this.stream.splithttp;
params.set("path", splithttp.path);
params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'));
params.set("mode", splithttp.mode);
break;
}
@@ -1586,6 +1600,7 @@ class Inbound extends XrayCommonClass {
const splithttp = this.stream.splithttp;
params.set("path", splithttp.path);
params.set("host", splithttp.host?.length > 0 ? splithttp.host : this.getHeader(splithttp, 'host'));
params.set("mode", splithttp.mode);
break;
}