feat(xhttp): default xmux maxConnections to 6

xray-core v26.6.27 changed the XHTTP client xmux default to maxConnections=6 (anti-RKN). The panel previously sent maxConnections=0, which overrode that default; default XHttpXmuxSchema to 6 so new outbounds adopt it and the wire-exclusivity rule drops maxConcurrency accordingly.
This commit is contained in:
MHSanaei
2026-06-27 20:26:03 +02:00
parent e44075a6e0
commit 33aada0c7c
2 changed files with 17 additions and 1 deletions
@@ -17,7 +17,7 @@ export type XHttpMode = z.infer<typeof XHttpModeSchema>;
// are strings because they accept dash-range values like '16-32'.
export const XHttpXmuxSchema = z.object({
maxConcurrency: z.string().default('16-32'),
maxConnections: z.union([z.string(), z.number()]).default(0),
maxConnections: z.union([z.string(), z.number()]).default(6),
cMaxReuseTimes: z.union([z.string(), z.number()]).default(0),
hMaxRequestTimes: z.string().default('600-900'),
hMaxReusableSecs: z.string().default('1800-3000'),
@@ -11,6 +11,7 @@ import {
} from '@/lib/xray/stream-wire-normalize';
import { InboundFormSchema } from '@/schemas/forms/inbound-form';
import type { InboundFormValues } from '@/schemas/forms/inbound-form';
import { XHttpXmuxSchema } from '@/schemas/protocols/stream/xhttp';
describe('validateRealityTarget', () => {
it('accepts host:port and bare port', () => {
@@ -150,6 +151,21 @@ describe('normalizeXhttpForWire stream-one', () => {
expect(xmux).not.toHaveProperty('maxConcurrency');
expect(xmux.maxConnections).toBe('8');
});
it('defaults xmux maxConnections to 6 (xray-core anti-RKN default) and drops maxConcurrency on the wire', () => {
expect(XHttpXmuxSchema.parse({}).maxConnections).toBe(6);
const out = normalizeXhttpForWire({
path: '/app',
mode: 'stream-one',
enableXmux: true,
xmux: XHttpXmuxSchema.parse({}),
}, 'outbound');
const xmux = out.xmux as Record<string, unknown>;
expect(xmux.maxConnections).toBe(6);
expect(xmux).not.toHaveProperty('maxConcurrency');
});
});
describe('normalizeSockoptForWire', () => {