Files
xk-hy-forward-go/README.md
2026-05-22 08:05:05 +08:00

46 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# xk-hy-forward-go
内网双通道透明转发:外网 `xk-hy-transit-go` 只访问本服务,由本机转发至浙江省政务云(`59.202.52.129`)。
## 架构
| 监听路径 | 转发目标 | 用途 |
|----------|----------|------|
| `POST /province/supervise/data` | `SUPERVISE_TARGET_URL`28212 | 加密后的监管业务 JSON |
| `POST /mng/file/auth/upload` | `FILE_TARGET_URL`28211 | 处方 PDF multipart 上传 |
| `GET /health` | 本地 | 健康检查 |
请求头与 body **原样透传**(含 `X-Authorization` uploadToken、multipart boundary
## 环境配置
```bash
cp .env.example .env
```
| 变量 | 默认 | 说明 |
|------|------|------|
| `LISTEN_ADDR` | `:8080` | 监听地址 |
| `SUPERVISE_TARGET_URL` | `https://59.202.52.129:28212/province/supervise/data` | 监管业务上报 |
| `FILE_TARGET_URL` | `https://59.202.52.129:28211/mng/file/auth/upload` | 处方 PDF 上传 |
| `TARGET_URL` | (兼容) | 未设 `SUPERVISE_TARGET_URL` 时等同旧版 |
| `ALLOW_IPS` | 空 | 逗号分隔来源 IP 白名单 |
| `LOG_DIR` | 空 | 日志根目录;默认 `{程序目录}/../log/forward/` |
## 运行
```bash
go run .
```
## 应用日志
每条转发写入 `app-YYYY-MM-DD.log`(同时输出控制台),格式:
```text
2026-05-19T22:00:01+08:00 | 192.168.1.20 | supervise | http=200 | 120ms | https://59.202.52.129:28212/...
2026-05-19T22:00:02+08:00 | 192.168.1.20 | file | http=200 | 80ms | https://59.202.52.129:28211/...
```
不记录完整 body 与 uploadToken。