diff --git a/frontend/src/schemas/protocols/stream/tcp.ts b/frontend/src/schemas/protocols/stream/tcp.ts index 05778e28..2d7a2ac9 100644 --- a/frontend/src/schemas/protocols/stream/tcp.ts +++ b/frontend/src/schemas/protocols/stream/tcp.ts @@ -38,10 +38,8 @@ export const TcpHeaderSchema = z.discriminatedUnion('type', [ ]); export type TcpHeader = z.infer; -// Top-level TCP stream payload. `acceptProxyProtocol` only appears on the -// wire when true (panel omits it when false), so we treat it as optional. export const TcpStreamSettingsSchema = z.object({ - acceptProxyProtocol: z.literal(true).optional(), + acceptProxyProtocol: z.boolean().default(false), header: TcpHeaderSchema.optional(), }); export type TcpStreamSettings = z.infer; diff --git a/frontend/src/test/__snapshots__/inbound-full.test.ts.snap b/frontend/src/test/__snapshots__/inbound-full.test.ts.snap index 274faf5d..67263f4f 100644 --- a/frontend/src/test/__snapshots__/inbound-full.test.ts.snap +++ b/frontend/src/test/__snapshots__/inbound-full.test.ts.snap @@ -43,7 +43,9 @@ exports[`InboundSchema (full) fixtures > parses hysteria-v1-tls byte-stably 1`] "streamSettings": { "network": "tcp", "security": "tls", - "tcpSettings": {}, + "tcpSettings": { + "acceptProxyProtocol": false, + }, "tlsSettings": { "alpn": [ "h3", @@ -125,6 +127,7 @@ exports[`InboundSchema (full) fixtures > parses shadowsocks-tcp-2022 byte-stably "network": "tcp", "security": "none", "tcpSettings": { + "acceptProxyProtocol": false, "header": { "type": "none", }, @@ -292,6 +295,7 @@ exports[`InboundSchema (full) fixtures > parses vless-tcp-reality byte-stably 1` }, "security": "reality", "tcpSettings": { + "acceptProxyProtocol": false, "header": { "type": "none", }, @@ -434,6 +438,7 @@ exports[`InboundSchema (full) fixtures > parses vmess-tcp-tls byte-stably 1`] = "network": "tcp", "security": "tls", "tcpSettings": { + "acceptProxyProtocol": false, "header": { "type": "none", }, diff --git a/frontend/src/test/__snapshots__/stream.test.ts.snap b/frontend/src/test/__snapshots__/stream.test.ts.snap index 67817b6e..733dcd9c 100644 --- a/frontend/src/test/__snapshots__/stream.test.ts.snap +++ b/frontend/src/test/__snapshots__/stream.test.ts.snap @@ -14,7 +14,9 @@ exports[`NetworkSettingsSchema fixtures > parses grpc-basic byte-stably 1`] = ` exports[`NetworkSettingsSchema fixtures > parses tcp-none byte-stably 1`] = ` { "network": "tcp", - "tcpSettings": {}, + "tcpSettings": { + "acceptProxyProtocol": false, + }, } `;