فهرست منبع

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.
MHSanaei 13 ساعت پیش
والد
کامیت
33aada0c7c
2فایلهای تغییر یافته به همراه17 افزوده شده و 1 حذف شده
  1. 1 1
      frontend/src/schemas/protocols/stream/xhttp.ts
  2. 16 0
      frontend/src/test/stream-wire-normalize.test.ts

+ 1 - 1
frontend/src/schemas/protocols/stream/xhttp.ts

@@ -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'),

+ 16 - 0
frontend/src/test/stream-wire-normalize.test.ts

@@ -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', () => {