diff --git a/docs/content/docs/en/config/transports.mdx b/docs/content/docs/en/config/transports.mdx
index d9c7450c2..2d0b517a8 100644
--- a/docs/content/docs/en/config/transports.mdx
+++ b/docs/content/docs/en/config/transports.mdx
@@ -107,6 +107,12 @@ Session-ID fields (`sessionIDPlacement`, `sessionIDKey`, `sessionIDTable`,
`sessionIDLength`) and the `scMin/MaxEachPostBytes` knobs are advanced; leave them
empty unless you're matching a specific upstream.
+Enable **Use separate download** to send the client's download requests to a
+second endpoint. Enter its address and port, then set the HTTP host, path, and
+security settings to match that endpoint. Both routes must reach the same XHTTP
+listener. On an inbound, the panel includes these settings in client subscriptions.
+The switch is available in `auto`, `packet-up`, and `stream-up` modes.
+
### Hysteria — `hysteriaSettings`
Only valid when the protocol is **Hysteria2**.
diff --git a/docs/content/docs/fa/config/transports.mdx b/docs/content/docs/fa/config/transports.mdx
index 058d6311b..98ee358c5 100644
--- a/docs/content/docs/fa/config/transports.mdx
+++ b/docs/content/docs/fa/config/transports.mdx
@@ -108,6 +108,12 @@ icon: Network
`sessionIDLength`) و کلیدهای `scMin/MaxEachPostBytes` پیشرفتهاند؛ آنها را خالی
بگذارید مگر آنکه با یک بالادست مشخص هماهنگ میشوید.
+برای فرستادن درخواستهای دانلود کلاینت به مقصدی جداگانه، **استفاده از مسیر دانلود جداگانه**
+را فعال کنید. آدرس و پورت مقصد را وارد کنید و مقادیر `host` و `path` در HTTP و
+تنظیمات امنیتی را مطابق آن مقصد تنظیم کنید. هر دو مسیر باید به یک شنوندهٔ XHTTP
+برسند. اگر این گزینه را در اتصال ورودی فعال کنید، پنل این تنظیمات را در اشتراک
+کلاینتها قرار میدهد. این گزینه در حالتهای `auto`، `packet-up` و `stream-up` در دسترس است.
+
### Hysteria — `hysteriaSettings`
تنها زمانی معتبر است که پروتکل **Hysteria2** باشد.
diff --git a/docs/content/docs/ru/config/transports.mdx b/docs/content/docs/ru/config/transports.mdx
index f70901269..8122d0657 100644
--- a/docs/content/docs/ru/config/transports.mdx
+++ b/docs/content/docs/ru/config/transports.mdx
@@ -110,6 +110,13 @@ HTTPUpgrade — это одноразовый HTTP/1.1 `Upgrade` без фрей
`sessionIDLength`) и параметры `scMin/MaxEachPostBytes` — продвинутые; оставьте
их пустыми, если только вы не подстраиваетесь под конкретный upstream.
+Включите **Использовать отдельный канал загрузки**, чтобы клиент отправлял запросы
+на скачивание на другой адрес. Укажите адрес и порт, затем задайте HTTP-параметры
+`host` и `path` и настройки безопасности для этой точки подключения. Оба маршрута
+должны вести к одному и тому же обработчику XHTTP. Если задать эти параметры для
+входящего подключения, панель включит их в клиентские подписки. Переключатель
+доступен в режимах `auto`, `packet-up` и `stream-up`.
+
### Hysteria — `hysteriaSettings`
Допустимо, только когда протокол — **Hysteria2**.
diff --git a/docs/content/docs/zh/config/transports.mdx b/docs/content/docs/zh/config/transports.mdx
index f40641254..1e178ef9e 100644
--- a/docs/content/docs/zh/config/transports.mdx
+++ b/docs/content/docs/zh/config/transports.mdx
@@ -103,6 +103,11 @@ Session-ID 字段(`sessionIDPlacement`、`sessionIDKey`、`sessionIDTable`、
`sessionIDLength`)以及 `scMin/MaxEachPostBytes` 旋钮属于高级项;除非要匹配某个特定的
上游,否则保持为空。
+启用**使用独立下载通道**后,客户端会向另一个端点发送下载请求。填写该端点的地址和端口,
+并按其要求设置 HTTP 主机名、路径和安全参数。上传和下载两条路由必须通往同一个 XHTTP
+监听器。在入站配置中启用此选项后,面板会将这些设置加入客户端订阅。此开关适用于
+`auto`、`packet-up` 和 `stream-up` 模式。
+
### Hysteria — `hysteriaSettings`
仅当协议为 **Hysteria2** 时有效。
diff --git a/frontend/src/lib/xray/forms/transport/XhttpDownloadForm.tsx b/frontend/src/lib/xray/forms/transport/XhttpDownloadForm.tsx
new file mode 100644
index 000000000..da7845c58
--- /dev/null
+++ b/frontend/src/lib/xray/forms/transport/XhttpDownloadForm.tsx
@@ -0,0 +1,155 @@
+import { useId } from 'react';
+import { Form, Input, InputNumber, Switch } from 'antd';
+import { useTranslation } from 'react-i18next';
+import { useFormContext, useWatch } from 'react-hook-form';
+
+import { NativeSelect } from '@/components/form/NativeSelect';
+import { FormField } from '@/components/form/rhf';
+import { UTLS_FINGERPRINT } from '@/schemas/primitives';
+
+const root = 'streamSettings.xhttpSettings.downloadSettings';
+
+// The core refuses to build a REALITY client whose fingerprint is unsafe or unknown.
+const REALITY_FINGERPRINT_OPTIONS = Object.values(UTLS_FINGERPRINT)
+ .filter((fp) => fp !== UTLS_FINGERPRINT.UTLS_UNSAFE)
+ .map((fp) => ({ value: fp, label: fp }));
+
+export function XhttpDownloadForm({ mode }: { mode?: string }) {
+ const { t } = useTranslation();
+ const id = useId();
+ const { control, getValues, setValue, unregister } = useFormContext();
+ const download = useWatch({ control, name: root });
+ const security = download?.security;
+ const securityBlock = security === 'reality' ? 'realitySettings' : 'tlsSettings';
+
+ return (
+ <>
+
+ {
+ if (enabled) {
+ const upload = getValues('streamSettings.xhttpSettings') ?? {};
+ const xhttpSettings: Record = { path: upload.path || '/' };
+ for (const key of [
+ 'host',
+ 'headers',
+ 'sessionIDPlacement',
+ 'sessionIDKey',
+ 'sessionIDTable',
+ 'sessionIDLength',
+ 'seqPlacement',
+ 'seqKey',
+ 'xPaddingBytes',
+ 'xPaddingObfsMode',
+ 'xPaddingKey',
+ 'xPaddingHeader',
+ 'xPaddingPlacement',
+ 'xPaddingMethod',
+ ]) {
+ if (upload[key] !== undefined) xhttpSettings[key] = structuredClone(upload[key]);
+ }
+ setValue(
+ root,
+ { network: 'xhttp', port: 443, security: 'tls', xhttpSettings },
+ { shouldDirty: true },
+ );
+ } else {
+ unregister(root);
+ }
+ }}
+ />
+
+ {download && (
+ <>
+ !!String(v).trim() || 'pages.xray.outboundForm.addressRequired',
+ }}
+ >
+
+
+
+
+
+
+
+
+
+
+
+ {
+ unregister(root + '.tlsSettings');
+ unregister(root + '.realitySettings');
+ if (value === 'reality')
+ setValue(root + '.realitySettings', { fingerprint: 'chrome' });
+ }}
+ >
+ ({ value, label: value }))}
+ />
+
+ {(security === 'tls' || security === 'reality') && (
+
+
+
+ )}
+ {security === 'reality' && (
+ <>
+
+
+
+
+
+
+
+
+
+ >
+ )}
+ >
+ )}
+ >
+ );
+}
diff --git a/frontend/src/lib/xray/inbound-form-adapter.ts b/frontend/src/lib/xray/inbound-form-adapter.ts
index 5bc566931..334bf93da 100644
--- a/frontend/src/lib/xray/inbound-form-adapter.ts
+++ b/frontend/src/lib/xray/inbound-form-adapter.ts
@@ -27,11 +27,9 @@ import {
import { canEnableSniffing } from '@/lib/xray/protocol-capabilities';
import { tlsCertUsesFiles } from '@/schemas/protocols/security/tls';
import { SockoptStreamSettingsSchema } from '@/schemas/protocols/stream/sockopt';
-import { XHttpStreamSettingsSchema, XHttpXmuxSchema } from '@/schemas/protocols/stream/xhttp';
+import { XHttpStreamSettingsSchema } from '@/schemas/protocols/stream/xhttp';
import { liftLegacyXDriveService } from '@/schemas/protocols/stream/xdrive';
-const XMUX_DEFAULTS = XHttpXmuxSchema.parse({});
-
// Plain-data adapter between the panel's stored inbound row shape and
// the typed InboundFormValues that Form.useForm carries inside
// InboundFormModal. No dependency on the legacy Inbound/DBInbound
@@ -197,7 +195,6 @@ export function rawInboundToFormValues(row: RawInboundRow): InboundFormValues {
const xmux = xhttp.xmux;
if (xmux && typeof xmux === 'object' && !Array.isArray(xmux)) {
xhttp.enableXmux = true;
- xhttp.xmux = { ...XMUX_DEFAULTS, ...(xmux as Record) };
}
}
const so = streamRecord.sockopt;
diff --git a/frontend/src/lib/xray/inbound-link.ts b/frontend/src/lib/xray/inbound-link.ts
index 6904c9b03..c16688b7b 100644
--- a/frontend/src/lib/xray/inbound-link.ts
+++ b/frontend/src/lib/xray/inbound-link.ts
@@ -14,6 +14,7 @@ import type { ExternalProxyEntry } from '@/schemas/protocols/stream/external-pro
import type { FinalMaskStreamSettings } from '@/schemas/protocols/stream/finalmask';
import type { XHttpStreamSettings } from '@/schemas/protocols/stream/xhttp';
+import { resolveXmuxExclusivity } from './stream-wire-normalize';
import { parseGeckoPacketSize } from '@/lib/xray/forms/transport/FinalMaskForm';
import { UTLS_FINGERPRINT } from '@/schemas/primitives';
import { hasWgQuickHook, joinConfLines } from './conf-lines';
@@ -87,12 +88,14 @@ function buildXhttpExtra(xhttp: XHttpStreamSettings | undefined): Record> = {
scMaxEachPostBytes: '1000000',
+ scMinPostsIntervalMs: '30',
};
for (const k of stringFields) {
const v = xhttp[k];
@@ -108,6 +111,17 @@ function buildXhttpExtra(xhttp: XHttpStreamSettings | undefined): Record 0) {
+ extra.xmux = resolveXmuxExclusivity(xhttp.xmux);
+ }
+ if (xhttp.downloadSettings && Object.keys(xhttp.downloadSettings).length > 0) {
+ extra.downloadSettings = xhttp.downloadSettings;
+ }
+ if (xhttp.noGRPCHeader) extra.noGRPCHeader = true;
+ if (xhttp.uplinkChunkSize && xhttp.uplinkChunkSize !== '0') {
+ extra.uplinkChunkSize = xhttp.uplinkChunkSize;
+ }
+
// Headers on the wire are a record; emit them as a map upstream's
// SplitHTTPConfig.headers expects, dropping Host (already on the URL).
if (xhttp.headers && Object.keys(xhttp.headers).length > 0) {
diff --git a/frontend/src/lib/xray/outbound-form-adapter.ts b/frontend/src/lib/xray/outbound-form-adapter.ts
index 340fdb476..06facd676 100644
--- a/frontend/src/lib/xray/outbound-form-adapter.ts
+++ b/frontend/src/lib/xray/outbound-form-adapter.ts
@@ -1,4 +1,4 @@
-import { XHttpXmuxSchema } from '@/schemas/protocols/stream/xhttp';
+import { flattenXhttpExtra } from '@/schemas/protocols/stream/xhttp';
import { liftLegacyXDriveService } from '@/schemas/protocols/stream/xdrive';
import { OutboundDomainStrategySchema } from '@/schemas/protocols/outbound';
import { AmneziaWGOutboundSettingsSchema } from '@/schemas/protocols/outbound';
@@ -572,8 +572,6 @@ export interface RawOutboundRow {
mux?: unknown;
}
-const XMUX_DEFAULTS = XHttpXmuxSchema.parse({});
-
function hydrateStreamForm(stream: Raw): OutboundStreamFormValues {
const next = { ...stream };
if (typeof next.method === 'string' && next.method !== '') {
@@ -583,11 +581,11 @@ function hydrateStreamForm(stream: Raw): OutboundStreamFormValues {
liftLegacyXDriveService(next);
const xh = next.xhttpSettings;
if (xh && typeof xh === 'object' && !Array.isArray(xh)) {
- const xhttp = { ...(xh as Raw) };
+ const xhttp = flattenXhttpExtra(xh as Raw);
const xmux = xhttp.xmux;
if (xmux && typeof xmux === 'object' && !Array.isArray(xmux)) {
xhttp.enableXmux = true;
- xhttp.xmux = { ...XMUX_DEFAULTS, ...(xmux as Raw) };
+ xhttp.xmux = { ...(xmux as Raw) };
}
next.xhttpSettings = xhttp;
}
diff --git a/frontend/src/lib/xray/outbound-link-parser.ts b/frontend/src/lib/xray/outbound-link-parser.ts
index 1b3b68db3..eed9d3d60 100644
--- a/frontend/src/lib/xray/outbound-link-parser.ts
+++ b/frontend/src/lib/xray/outbound-link-parser.ts
@@ -100,7 +100,9 @@ function applyXhttpStringFromParams(xhttp: Raw, params: URLSearchParams): void {
}
for (const k of XHTTP_NUMBER_KEYS) {
const v = params.get(k);
- if (v !== null && v !== '') xhttp[k] = Number(v) || 0;
+ if (v !== null && v !== '') {
+ xhttp[k] = k === 'uplinkChunkSize' && v.includes('-') ? v : Number(v) || 0;
+ }
}
for (const k of XHTTP_BOOL_KEYS) {
const v = params.get(k);
@@ -125,7 +127,9 @@ function applyXhttpStringFromJson(xhttp: Raw, json: Record): vo
}
}
for (const k of XHTTP_NUMBER_KEYS) {
- if (typeof json[k] === 'number') xhttp[k] = json[k];
+ if (typeof json[k] === 'number' || (k === 'uplinkChunkSize' && typeof json[k] === 'string')) {
+ xhttp[k] = json[k];
+ }
}
for (const k of XHTTP_BOOL_KEYS) {
if (typeof json[k] === 'boolean') xhttp[k] = json[k];
diff --git a/frontend/src/lib/xray/stream-wire-normalize.ts b/frontend/src/lib/xray/stream-wire-normalize.ts
index 18c87ce12..a1b098d17 100644
--- a/frontend/src/lib/xray/stream-wire-normalize.ts
+++ b/frontend/src/lib/xray/stream-wire-normalize.ts
@@ -5,6 +5,8 @@
// them anyway bloats configs and — for sockopt — can inject doc-example
// values like tcpWindowClamp: 600 that throttle throughput.
+import { flattenXhttpExtra } from '@/schemas/protocols/stream/xhttp';
+
export type StreamWireSide = 'inbound' | 'outbound';
const PACKET_UP_FIELDS = [
@@ -60,7 +62,7 @@ export function int32RangeUpper(v: unknown): number {
// and maxConcurrency. A positive maxConnections is an explicit opt-in to
// connection-pool mode — honor it and drop the leftover maxConcurrency
// default that load-time hydration backfills onto older saved configs.
-function resolveXmuxExclusivity(xmux: Record): Record {
+export function resolveXmuxExclusivity(xmux: Record): Record {
if (int32RangeUpper(xmux.maxConnections) > 0 && int32RangeUpper(xmux.maxConcurrency) > 0) {
const out = { ...xmux };
delete out.maxConcurrency;
@@ -222,7 +224,7 @@ export function normalizeXhttpForWire(
raw: Record,
side: StreamWireSide,
): Record {
- const out: Record = { ...raw };
+ const out = flattenXhttpExtra(raw);
liftLegacyXhttpSessionKeys(out);
const mode = typeof out.mode === 'string' && out.mode !== '' ? out.mode : 'auto';
const enableXmux = out.enableXmux === true;
@@ -236,7 +238,6 @@ export function normalizeXhttpForWire(
if (out.scMinPostsIntervalMs === '' || out.scMinPostsIntervalMs === '30') {
delete out.scMinPostsIntervalMs;
}
- delete out.uplinkChunkSize;
}
if (isRecord(out.xmux)) {
@@ -259,7 +260,8 @@ export function normalizeXhttpForWire(
if (out.noGRPCHeader !== true) delete out.noGRPCHeader;
if (out.noSSEHeader !== true) delete out.noSSEHeader;
if (out.serverMaxHeaderBytes === 0) delete out.serverMaxHeaderBytes;
- if (out.uplinkChunkSize === 0) delete out.uplinkChunkSize;
+ if (out.uplinkChunkSize === 0 || out.uplinkChunkSize === '' || out.uplinkChunkSize === '0')
+ delete out.uplinkChunkSize;
if (mode === 'stream-one') {
for (const key of PACKET_UP_FIELDS) delete out[key];
diff --git a/frontend/src/pages/inbounds/form/advanced-editors.tsx b/frontend/src/pages/inbounds/form/advanced-editors.tsx
index a8d948762..6f58a0bb8 100644
--- a/frontend/src/pages/inbounds/form/advanced-editors.tsx
+++ b/frontend/src/pages/inbounds/form/advanced-editors.tsx
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import { useFormContext, useWatch } from 'react-hook-form';
+import { flattenXhttpExtra } from '@/schemas/protocols/stream/xhttp';
import { JsonEditor } from '@/components/form';
import {
pruneEmpty,
@@ -9,6 +10,15 @@ import {
dropLegacyOptionalEmpties,
} from '@/lib/xray/inbound-form-adapter';
+function normalizeAdvancedStream(stream: unknown): unknown {
+ if (!stream || typeof stream !== 'object' || !('xhttpSettings' in stream)) return stream;
+ const xhttp = stream.xhttpSettings;
+ if (!xhttp || typeof xhttp !== 'object' || Array.isArray(xhttp)) return stream;
+ const flat = flattenXhttpExtra(xhttp as Record);
+ if (flat.xmux) flat.enableXmux = true;
+ return { ...stream, xhttpSettings: flat };
+}
+
/*
* Sub-editor for one slice of the form (settings, streamSettings, sniffing).
* Holds a local text buffer so the user can type freely; on every keystroke
@@ -71,8 +81,9 @@ export function AdvancedSliceEditor({
wrapKey && parsed && typeof parsed === 'object' && !Array.isArray(parsed)
? ((parsed as Record)[wrapKey] ?? {})
: parsed;
- setValue(path, toWrite);
- lastEmitRef.current = JSON.stringify(wrapKey ? { [wrapKey]: toWrite } : toWrite, null, 2);
+ const value = path === 'streamSettings' ? normalizeAdvancedStream(toWrite) : toWrite;
+ setValue(path, value);
+ lastEmitRef.current = serialize(value);
} catch {
/* invalid JSON; keep buffer, don't push to form */
}
@@ -228,6 +239,7 @@ export function AdvancedAllEditor({
setValue('sniffing', parsed.sniffing);
}
if (streamEnabled && parsed.streamSettings && typeof parsed.streamSettings === 'object') {
+ parsed.streamSettings = normalizeAdvancedStream(parsed.streamSettings);
setValue('streamSettings', parsed.streamSettings);
}
const canonical = serialize();
diff --git a/frontend/src/pages/inbounds/form/transport/xhttp.tsx b/frontend/src/pages/inbounds/form/transport/xhttp.tsx
index 257db7d6a..cfce41f60 100644
--- a/frontend/src/pages/inbounds/form/transport/xhttp.tsx
+++ b/frontend/src/pages/inbounds/form/transport/xhttp.tsx
@@ -3,9 +3,15 @@ import { useTranslation } from 'react-i18next';
import { AutoComplete, Input, InputNumber, Switch } from 'antd';
import { useFormContext, useWatch } from 'react-hook-form';
+import { XhttpDownloadForm } from '@/lib/xray/forms/transport/XhttpDownloadForm';
import { HeaderMapEditor } from '@/components/form';
-import { FormField } from '@/components/form/rhf';
-import { XHTTP_SESSION_ID_TABLES, XMUX_FRESH_DEFAULTS } from '@/schemas/protocols/stream/xhttp';
+import { FormField, rhfZodValidate } from '@/components/form/rhf';
+import {
+ XHttpChunkSizeSchema,
+ xhttpUplinkMethods,
+ XHTTP_SESSION_ID_TABLES,
+ XMUX_FRESH_DEFAULTS,
+} from '@/schemas/protocols/stream/xhttp';
import { validateSessionIDLength, validateSessionIDTable } from '@/lib/xray/xhttp-session-id';
import { int32RangeUpper } from '@/lib/xray/stream-wire-normalize';
@@ -46,6 +52,11 @@ export default function XhttpForm() {
control,
name: 'streamSettings.xhttpSettings.uplinkDataPlacement',
}) as string | undefined;
+ const method = useWatch({ control, name: 'streamSettings.xhttpSettings.uplinkHTTPMethod' });
+ const hasDownload = !!useWatch({
+ control,
+ name: 'streamSettings.xhttpSettings.downloadSettings',
+ });
const enableXmux = !!useWatch({ control, name: 'streamSettings.xhttpSettings.enableXmux' });
function onXmuxToggle(checked: boolean) {
@@ -87,6 +98,9 @@ export default function XhttpForm() {
options={(['auto', 'packet-up', 'stream-up', 'stream-one'] as const).map((m) => ({
value: m,
label: m,
+ disabled:
+ (m === 'stream-one' && hasDownload) ||
+ !!xhttpUplinkMethods(m).find((option) => option.value === method)?.disabled,
}))}
/>
@@ -150,19 +164,9 @@ export default function XhttpForm() {
name={['streamSettings', 'xhttpSettings', 'uplinkHTTPMethod']}
label={t('pages.inbounds.form.uplinkHttpMethod')}
>
-
+
+
+ {(xhttpMode === 'auto' || xhttpMode === 'stream-up' || xhttpMode === 'stream-one') && (
+
+
+
+ )}
+ {xhttpMode === 'packet-up' && xhttpUplinkPlacement && xhttpUplinkPlacement !== 'body' && (
+
+
+
+ )}
{/* XMUX is the connection-multiplexing layer
xHTTP uses to fan out parallel requests over
a small pool of upstream connections. UI-only
diff --git a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx
index 4e574494a..e05a87e1d 100644
--- a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx
+++ b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx
@@ -9,7 +9,7 @@ import { Wireguard } from '@/utils';
import { formValuesToWirePayload, rawOutboundToFormValues } from '@/lib/xray/outbound-form-adapter';
import { parseOutboundLink } from '@/lib/xray/outbound-link-parser';
import XDriveForm from '@/lib/xray/forms/transport/XDriveForm';
-import { XMUX_FRESH_DEFAULTS } from '@/schemas/protocols/stream/xhttp';
+import { XHttpChunkSizeSchema, XMUX_FRESH_DEFAULTS } from '@/schemas/protocols/stream/xhttp';
import { OutboundFormBaseSchema, type OutboundFormValues } from '@/schemas/forms/outbound-form';
import {
canEnableReality,
@@ -350,6 +350,15 @@ export default function OutboundFormModal({
if (!(await methods.trigger())) return;
values = methods.getValues();
}
+ if (values.streamSettings?.network === 'xhttp') {
+ const result = XHttpChunkSizeSchema.safeParse(
+ values.streamSettings.xhttpSettings?.uplinkChunkSize,
+ );
+ if (!result.success) {
+ messageApi.error(result.error.issues[0].message);
+ return;
+ }
+ }
const tagValue = (values.tag ?? '').trim();
if (!tagValue) {
messageApi.error(t('pages.xray.outboundForm.tagRequired'));
diff --git a/frontend/src/pages/xray/outbounds/transport/xhttp.tsx b/frontend/src/pages/xray/outbounds/transport/xhttp.tsx
index a18f6a634..3b15163db 100644
--- a/frontend/src/pages/xray/outbounds/transport/xhttp.tsx
+++ b/frontend/src/pages/xray/outbounds/transport/xhttp.tsx
@@ -2,11 +2,16 @@ import { useTranslation } from 'react-i18next';
import { AutoComplete, Input, InputNumber, Select, Switch } from 'antd';
import { useFormContext, useWatch } from 'react-hook-form';
+import { XhttpDownloadForm } from '@/lib/xray/forms/transport/XhttpDownloadForm';
import { HeaderMapEditor } from '@/components/form';
-import { FormField } from '@/components/form/rhf';
+import { FormField, rhfZodValidate } from '@/components/form/rhf';
import { validateSessionIDLength, validateSessionIDTable } from '@/lib/xray/xhttp-session-id';
import { int32RangeUpper } from '@/lib/xray/stream-wire-normalize';
-import { XHTTP_SESSION_ID_TABLES } from '@/schemas/protocols/stream/xhttp';
+import {
+ XHttpChunkSizeSchema,
+ xhttpUplinkMethods,
+ XHTTP_SESSION_ID_TABLES,
+} from '@/schemas/protocols/stream/xhttp';
import { MODE_OPTIONS } from '../outbound-form-constants';
@@ -40,6 +45,11 @@ export default function XhttpForm({ onXmuxToggle }: XhttpFormProps) {
const uplinkDataPlacement = useWatch({ control, name: `${XH}.uplinkDataPlacement` }) as
| string
| undefined;
+ const method = useWatch({ control, name: 'streamSettings.xhttpSettings.uplinkHTTPMethod' });
+ const hasDownload = !!useWatch({
+ control,
+ name: 'streamSettings.xhttpSettings.downloadSettings',
+ });
const enableXmux = !!useWatch({ control, name: `${XH}.enableXmux` });
function onXmuxMaxConcurrencyChange(value: unknown) {
@@ -68,7 +78,15 @@ export default function XhttpForm({ onXmuxToggle }: XhttpFormProps) {
label={t('pages.inbounds.info.mode')}
name={['streamSettings', 'xhttpSettings', 'mode']}
>
-
+