> For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt.

# 平台代理

GZCTF 自带对于流量的 WebSocket-TCP 转发功能和对应的流量记录能力，可以通过相关配置项进行开启。

## 配置

在 `appsettings.json` 中，找到 `ContainerProvider` 节点，进行如下配置：

```json
{
  "ContainerProvider": {
    "PortMappingType": "PlatformProxy",
    "EnableTrafficCapture": false,
    "DockerConfig": {
      // 可选，题目网络的前缀（Docker 后端）
      "ChallengeNetwork": "challenges"
    }
  }
}
```

## 使用

在平台代理开启后，可以使用平台的 `/api/proxy/{guid}` 接口进行 TCP over WebSocket 流量转发。

可用任意支持此方式的程序进行连接，或使用推荐客户端：[WebSocketReflectorX](https://github.com/XDSEC/WebSocketReflectorX) 进行本地端口代理，从而进行无感交互。

## 注意事项

采用 `Docker` 单机作为后端且使用 `PlatformProxy` 端口映射类型时，GZCTF 需要通过网络访问题目容器。

自 **v1.8.0** 起，`ChallengeNetwork` 的值被视为**网络前缀**。GZCTF 会自动创建 `<ChallengeNetwork>-open` 和 `<ChallengeNetwork>-isolated` 网络（默认前缀为 `gzctf`），并将自身接入这些网络，因此默认（`open` / `isolated`）网络模式无需手动创建网络。

如果使用 `custom` 网络模式，需要在启动题目容器之前自行创建 `<ChallengeNetwork>-custom` 网络，例如：

```bash
docker network create challenges-custom -d bridge --subnet 192.168.133.0/24
```

并将配置项 **ChallengeNetwork** 设置为对应的前缀，例如 `challenges`。
