Skip to content

Commit 30559b3

Browse files
XHTTP transport: New options for bypassing CDN's detection
XTLS/Xray-core#5414
1 parent ec5f7e1 commit 30559b3

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

internal/web/assets/js/model/inbound.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,19 @@ class xHTTPStreamSettings extends XrayCommonClass {
487487
noSSEHeader = false,
488488
xPaddingBytes = "100-1000",
489489
mode = MODE_OPTION.AUTO,
490+
xPaddingObfsMode = false,
491+
xPaddingKey = '',
492+
xPaddingHeader = '',
493+
xPaddingPlacement = '',
494+
xPaddingMethod = '',
495+
uplinkHTTPMethod = '',
496+
sessionPlacement = '',
497+
sessionKey = '',
498+
seqPlacement = '',
499+
seqKey = '',
500+
uplinkDataPlacement = '',
501+
uplinkDataKey = '',
502+
uplinkChunkSize = 0,
490503
) {
491504
super();
492505
this.path = path;
@@ -498,6 +511,19 @@ class xHTTPStreamSettings extends XrayCommonClass {
498511
this.noSSEHeader = noSSEHeader;
499512
this.xPaddingBytes = xPaddingBytes;
500513
this.mode = mode;
514+
this.xPaddingObfsMode = xPaddingObfsMode;
515+
this.xPaddingKey = xPaddingKey;
516+
this.xPaddingHeader = xPaddingHeader;
517+
this.xPaddingPlacement = xPaddingPlacement;
518+
this.xPaddingMethod = xPaddingMethod;
519+
this.uplinkHTTPMethod = uplinkHTTPMethod;
520+
this.sessionPlacement = sessionPlacement;
521+
this.sessionKey = sessionKey;
522+
this.seqPlacement = seqPlacement;
523+
this.seqKey = seqKey;
524+
this.uplinkDataPlacement = uplinkDataPlacement;
525+
this.uplinkDataKey = uplinkDataKey;
526+
this.uplinkChunkSize = uplinkChunkSize;
501527
}
502528

503529
addHeader(name, value) {
@@ -519,6 +545,19 @@ class xHTTPStreamSettings extends XrayCommonClass {
519545
json.noSSEHeader,
520546
json.xPaddingBytes,
521547
json.mode,
548+
json.xPaddingObfsMode,
549+
json.xPaddingKey,
550+
json.xPaddingHeader,
551+
json.xPaddingPlacement,
552+
json.xPaddingMethod,
553+
json.uplinkHTTPMethod,
554+
json.sessionPlacement,
555+
json.sessionKey,
556+
json.seqPlacement,
557+
json.seqKey,
558+
json.uplinkDataPlacement,
559+
json.uplinkDataKey,
560+
json.uplinkChunkSize,
522561
);
523562
}
524563

@@ -533,6 +572,19 @@ class xHTTPStreamSettings extends XrayCommonClass {
533572
noSSEHeader: this.noSSEHeader,
534573
xPaddingBytes: this.xPaddingBytes,
535574
mode: this.mode,
575+
xPaddingObfsMode: this.xPaddingObfsMode,
576+
xPaddingKey: this.xPaddingKey,
577+
xPaddingHeader: this.xPaddingHeader,
578+
xPaddingPlacement: this.xPaddingPlacement,
579+
xPaddingMethod: this.xPaddingMethod,
580+
uplinkHTTPMethod: this.uplinkHTTPMethod,
581+
sessionPlacement: this.sessionPlacement,
582+
sessionKey: this.sessionKey,
583+
seqPlacement: this.seqPlacement,
584+
seqKey: this.seqKey,
585+
uplinkDataPlacement: this.uplinkDataPlacement,
586+
uplinkDataKey: this.uplinkDataKey,
587+
uplinkChunkSize: this.uplinkChunkSize,
536588
};
537589
}
538590
}

internal/web/html/xui/form/stream/stream_xhttp.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,95 @@
4040
<a-form-item label="Padding Bytes">
4141
<a-input v-model.trim="inbound.stream.xhttp.xPaddingBytes"></a-input>
4242
</a-form-item>
43+
<a-form-item label="Padding Obfs Mode">
44+
<a-switch v-model="inbound.stream.xhttp.xPaddingObfsMode"></a-switch>
45+
</a-form-item>
46+
<template v-if="inbound.stream.xhttp.xPaddingObfsMode">
47+
<a-form-item label="Padding Key">
48+
<a-input v-model.trim="inbound.stream.xhttp.xPaddingKey"
49+
placeholder="x_padding"></a-input>
50+
</a-form-item>
51+
<a-form-item label="Padding Header">
52+
<a-input v-model.trim="inbound.stream.xhttp.xPaddingHeader"
53+
placeholder="X-Padding"></a-input>
54+
</a-form-item>
55+
<a-form-item label="Padding Placement">
56+
<a-select v-model="inbound.stream.xhttp.xPaddingPlacement"
57+
:dropdown-class-name="themeSwitcher.currentTheme">
58+
<a-select-option value>Default (queryInHeader)</a-select-option>
59+
<a-select-option
60+
value="queryInHeader">queryInHeader</a-select-option>
61+
<a-select-option value="header">header</a-select-option>
62+
</a-select>
63+
</a-form-item>
64+
<a-form-item label="Padding Method">
65+
<a-select v-model="inbound.stream.xhttp.xPaddingMethod"
66+
:dropdown-class-name="themeSwitcher.currentTheme">
67+
<a-select-option value>Default (repeat-x)</a-select-option>
68+
<a-select-option value="repeat-x">repeat-x</a-select-option>
69+
<a-select-option value="tokenish">tokenish</a-select-option>
70+
</a-select>
71+
</a-form-item>
72+
</template>
73+
<a-form-item label="Uplink HTTP Method">
74+
<a-select v-model="inbound.stream.xhttp.uplinkHTTPMethod"
75+
:dropdown-class-name="themeSwitcher.currentTheme">
76+
<a-select-option value>Default (POST)</a-select-option>
77+
<a-select-option value="POST">POST</a-select-option>
78+
<a-select-option value="PUT">PUT</a-select-option>
79+
<a-select-option value="GET">GET (packet-up only)</a-select-option>
80+
</a-select>
81+
</a-form-item>
82+
<a-form-item label="Session Placement">
83+
<a-select v-model="inbound.stream.xhttp.sessionPlacement"
84+
:dropdown-class-name="themeSwitcher.currentTheme">
85+
<a-select-option value>Default (path)</a-select-option>
86+
<a-select-option value="path">path</a-select-option>
87+
<a-select-option value="header">header</a-select-option>
88+
<a-select-option value="cookie">cookie</a-select-option>
89+
<a-select-option value="query">query</a-select-option>
90+
</a-select>
91+
</a-form-item>
92+
<a-form-item label="Session Key"
93+
v-if="inbound.stream.xhttp.sessionPlacement && inbound.stream.xhttp.sessionPlacement !== 'path'">
94+
<a-input v-model.trim="inbound.stream.xhttp.sessionKey"
95+
placeholder="x_session"></a-input>
96+
</a-form-item>
97+
<a-form-item label="Sequence Placement">
98+
<a-select v-model="inbound.stream.xhttp.seqPlacement"
99+
:dropdown-class-name="themeSwitcher.currentTheme">
100+
<a-select-option value>Default (path)</a-select-option>
101+
<a-select-option value="path">path</a-select-option>
102+
<a-select-option value="header">header</a-select-option>
103+
<a-select-option value="cookie">cookie</a-select-option>
104+
<a-select-option value="query">query</a-select-option>
105+
</a-select>
106+
</a-form-item>
107+
<a-form-item label="Sequence Key"
108+
v-if="inbound.stream.xhttp.seqPlacement && inbound.stream.xhttp.seqPlacement !== 'path'">
109+
<a-input v-model.trim="inbound.stream.xhttp.seqKey"
110+
placeholder="x_seq"></a-input>
111+
</a-form-item>
112+
<a-form-item label="Uplink Data Placement"
113+
v-if="inbound.stream.xhttp.mode === 'packet-up'">
114+
<a-select v-model="inbound.stream.xhttp.uplinkDataPlacement"
115+
:dropdown-class-name="themeSwitcher.currentTheme">
116+
<a-select-option value>Default (body)</a-select-option>
117+
<a-select-option value="body">body</a-select-option>
118+
<a-select-option value="header">header</a-select-option>
119+
<a-select-option value="query">query</a-select-option>
120+
</a-select>
121+
</a-form-item>
122+
<a-form-item label="Uplink Data Key"
123+
v-if="inbound.stream.xhttp.mode === 'packet-up' && inbound.stream.xhttp.uplinkDataPlacement && inbound.stream.xhttp.uplinkDataPlacement !== 'body'">
124+
<a-input v-model.trim="inbound.stream.xhttp.uplinkDataKey"
125+
placeholder="x_data"></a-input>
126+
</a-form-item>
127+
<a-form-item label="Uplink Chunk Size"
128+
v-if="inbound.stream.xhttp.mode === 'packet-up' && inbound.stream.xhttp.uplinkDataPlacement && inbound.stream.xhttp.uplinkDataPlacement !== 'body'">
129+
<a-input-number v-model.number="inbound.stream.xhttp.uplinkChunkSize"
130+
:min="0" placeholder="0 (unlimited)"></a-input-number>
131+
</a-form-item>
43132
<a-form-item label="No SSE Header">
44133
<a-switch v-model="inbound.stream.xhttp.noSSEHeader"></a-switch>
45134
</a-form-item>

0 commit comments

Comments
 (0)