Browse Source

feat(frontend): inbound TCP HTTP camouflage response fields + request headers

Complete the TCP HTTP camouflage UI on the inbound side.

Already there from the previous symmetric host/path commit:
- Request host (string[] via comma-string)
- Request path (string[] via comma-string)

This commit adds:
- Request headers (V2 map: name -> string[]) via HeaderMapEditor.
- Response version (defaults to '1.1' when camouflage toggles on).
- Response status (defaults to '200').
- Response reason (defaults to 'OK').
- Response headers (V2 map) via HeaderMapEditor.

The HTTP camouflage Switch seeds both request and response sub-objects
on toggle-on so xray-core sees a valid TcpHeader.http shape from the
first save. Without the response seed, partial fills would emit a
schema-incomplete response block that xray-core might reject.
MHSanaei 9 giờ trước cách đây
mục cha
commit
01991e74b1
1 tập tin đã thay đổi với 56 bổ sung0 xóa
  1. 56 0
      frontend/src/pages/inbounds/InboundFormModal.tsx

+ 56 - 0
frontend/src/pages/inbounds/InboundFormModal.tsx

@@ -1234,6 +1234,12 @@ export default function InboundFormModal({
                                 path: ['/'],
                                 headers: {},
                               },
+                              response: {
+                                version: '1.1',
+                                status: '200',
+                                reason: 'OK',
+                                headers: {},
+                              },
                             }
                           : { type: 'none' },
                       );
@@ -1295,6 +1301,56 @@ export default function InboundFormModal({
                   >
                     <Input placeholder="/,/api,/static" />
                   </Form.Item>
+                  <Form.Item
+                    label="Request headers"
+                    name={[
+                      'streamSettings', 'tcpSettings', 'header',
+                      'request', 'headers',
+                    ]}
+                  >
+                    <HeaderMapEditor mode="v2" />
+                  </Form.Item>
+
+                  {/* Response side: shaped as a separate sub-object on the
+                      wire ({version, status, reason, headers}). Inbound is
+                      the server, so the response side is the one the panel
+                      sends back to clients during HTTP camouflage. */}
+                  <Form.Item
+                    label="Response version"
+                    name={[
+                      'streamSettings', 'tcpSettings', 'header',
+                      'response', 'version',
+                    ]}
+                  >
+                    <Input placeholder="1.1" />
+                  </Form.Item>
+                  <Form.Item
+                    label="Response status"
+                    name={[
+                      'streamSettings', 'tcpSettings', 'header',
+                      'response', 'status',
+                    ]}
+                  >
+                    <Input placeholder="200" />
+                  </Form.Item>
+                  <Form.Item
+                    label="Response reason"
+                    name={[
+                      'streamSettings', 'tcpSettings', 'header',
+                      'response', 'reason',
+                    ]}
+                  >
+                    <Input placeholder="OK" />
+                  </Form.Item>
+                  <Form.Item
+                    label="Response headers"
+                    name={[
+                      'streamSettings', 'tcpSettings', 'header',
+                      'response', 'headers',
+                    ]}
+                  >
+                    <HeaderMapEditor mode="v2" />
+                  </Form.Item>
                 </>
               );
             }}