Skip to content

Commit a85ff0f

Browse files
committed
docs: update docs
1 parent 224874b commit a85ff0f

6 files changed

Lines changed: 180 additions & 7 deletions

File tree

README-zhCN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
## ✨ 核心特性
1111

1212
- 🔒 **安全优先**:命令路径白名单、参数验证、严格模式和安全日志记录
13-
-**高性能**:可配置并发、速率限制和优化的请求处理
13+
-**高性能**:可配置并发、速率限制(含基于 Redis 的分布式限流)与优化的请求处理
1414
- 🎯 **灵活配置**:支持 JSON 和 YAML 配置文件,支持 Go 模板
1515
- 🔐 **高级认证**:多种触发规则类型,包括 HMAC 签名验证、IP 白名单和自定义规则
16-
- 📊 **可观测性**:内置 Prometheus 指标、健康检查端点和全面的日志记录
16+
- 📊 **可观测性**:内置 Prometheus 指标、健康检查端点、OpenTelemetry 追踪、审计日志与全面日志
1717
- 🐳 **容器就绪**:官方 Docker 镜像,提供多个变体
1818
- 🌍 **国际化**:完整的中英文文档支持
1919
- 🔄 **热重载**:无需重启服务器即可更新钩子配置

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
## ✨ Key Features
1111

1212
- 🔒 **Security First**: Command path whitelisting, argument validation, strict mode, and secure logging
13-
-**High Performance**: Configurable concurrency, rate limiting, and optimized request handling
13+
-**High Performance**: Configurable concurrency, rate limiting (including Redis-backed distributed), and optimized request handling
1414
- 🎯 **Flexible Configuration**: Support for JSON and YAML configuration files with Go template support
1515
- 🔐 **Advanced Authentication**: Multiple trigger rule types including HMAC signature validation, IP whitelisting, and custom rules
16-
- 📊 **Observability**: Built-in Prometheus metrics, health check endpoint, and comprehensive logging
16+
- 📊 **Observability**: Built-in Prometheus metrics, health check endpoint, OpenTelemetry tracing, audit logging, and comprehensive logging
1717
- 🐳 **Container Ready**: Official Docker images with multiple variants
1818
- 🌍 **Internationalization**: Full support for English and Chinese documentation
1919
- 🔄 **Hot Reload**: Update hook configurations without restarting the server
@@ -146,7 +146,7 @@ For more security options, see:
146146

147147
## Additional Features
148148

149-
- **Form Data Support**: Parse multipart form data and file uploads - see [Form Data](docs/en-US/Form-Data.md)
149+
- **Form Data Support**: Parse multipart form data and file uploads - see [Form Data](docs/en-US/Referencing-Request-Values.md)
150150
- **Template Support**: Use Go templates in configuration files with `-template` flag - see [Templates](docs/en-US/Templates.md)
151151
- **HTTPS**: Use a reverse proxy (nginx, Traefik, Caddy) for HTTPS support
152152
- **CORS**: Set custom headers including CORS headers with `-header name=value`

docs/en-US/Migration-Guide.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,16 @@ docker run -d \
370370
- Health check endpoint
371371
- System metrics
372372

373+
### Observability and Compliance
374+
375+
This fork also supports:
376+
377+
- **Distributed tracing (OpenTelemetry/OTLP):** Export traces to any OTLP-compatible backend. Use `-tracing-enabled`, `-otlp-endpoint`, and `-tracing-service-name`.
378+
- **Audit logging:** Record hook executions and requests to file, Redis, or database. Use `-audit-enabled`, `-audit-storage-type`, `-audit-file-path`, and related options.
379+
- **Redis-based distributed rate limiting:** Share rate-limit state across multiple webhook instances. Use `-redis-enabled`, `-redis-addr`, `-rate-limit-window`, and related options.
380+
381+
For full parameter lists and environment variables, see [Webhook Parameters](Webhook-Parameters.md).
382+
373383
---
374384

375385
## Migration Checklist

docs/en-US/Webhook-Parameters.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ This document describes all available command-line parameters and environment va
4040
| `-x-request-id` | Use X-Request-Id header, if present, as request ID | `false` |
4141
| `-x-request-id-limit int` | Truncate X-Request-Id header to limit | `0` (no limit) |
4242

43+
*Note:* The length limit is configurable only via the `-x-request-id-limit` flag; no separate environment variable is defined in the current implementation.
44+
4345
### Response Headers
4446

4547
| Flag | Description | Default |
@@ -78,6 +80,17 @@ This document describes all available command-line parameters and environment va
7880
| `-rate-limit-rps int` | Rate limit requests per second | `100` |
7981
| `-rate-limit-burst int` | Rate limit burst size | `10` |
8082

83+
### Redis Rate Limiting
84+
85+
| Flag | Description | Default |
86+
|------|-------------|---------|
87+
| `-redis-enabled` | Enable Redis for distributed rate limiting | `false` |
88+
| `-redis-addr string` | Redis server address | `localhost:6379` |
89+
| `-redis-password string` | Redis password | (empty) |
90+
| `-redis-db int` | Redis database index | `0` |
91+
| `-redis-key-prefix string` | Redis key prefix for rate limiting | `webhook:ratelimit:` |
92+
| `-rate-limit-window int` | Rate limit window in seconds | `60` |
93+
8194
### HTTP Server Timeouts
8295

8396
| Flag | Description | Default |
@@ -98,6 +111,25 @@ This document describes all available command-line parameters and environment va
98111
| `-max-args-count int` | Maximum number of command arguments | `1000` |
99112
| `-strict-mode` | Reject arguments containing potentially dangerous characters | `false` |
100113

114+
### Tracing
115+
116+
| Flag | Description | Default |
117+
|------|-------------|---------|
118+
| `-tracing-enabled` | Enable distributed tracing with OpenTelemetry | `false` |
119+
| `-otlp-endpoint string` | OTLP exporter endpoint (e.g., localhost:4318) | (empty) |
120+
| `-tracing-service-name string` | Service name for tracing | `webhook` |
121+
122+
### Audit
123+
124+
| Flag | Description | Default |
125+
|------|-------------|---------|
126+
| `-audit-enabled` | Enable audit logging | `false` |
127+
| `-audit-storage-type string` | Audit storage type: file, redis, or database | `file` |
128+
| `-audit-file-path string` | Audit log file path when storage type is file | `./audit.log` |
129+
| `-audit-queue-size int` | Audit async write queue size | `1000` |
130+
| `-audit-workers int` | Number of audit async write workers | `2` |
131+
| `-audit-mask-ip` | Mask IP addresses in audit logs | `true` |
132+
101133
### Other
102134

103135
| Flag | Description | Default |
@@ -138,9 +170,10 @@ All command-line parameters can also be set via environment variables:
138170
| `MAX_MPART_MEM` | `-max-multipart-mem` | Max multipart memory | `1048576` |
139171
| `MAX_REQUEST_BODY_SIZE` | `-max-request-body-size` | Max request body size | `10485760` |
140172
| `X_REQUEST_ID` | `-x-request-id` | Use X-Request-Id | `false` |
141-
| `X_REQUEST_ID_LIMIT` | `-x-request-id-limit` | X-Request-Id limit | `0` |
142173
| `HEADER` | `-header` | Response header | - |
143174

175+
*Note:* The X-Request-Id length limit is only configurable via the `-x-request-id-limit` flag; there is no dedicated environment variable.
176+
144177
### Process Management
145178

146179
| Environment Variable | CLI Flag | Description | Default |
@@ -173,6 +206,17 @@ All command-line parameters can also be set via environment variables:
173206
| `RATE_LIMIT_RPS` | `-rate-limit-rps` | Requests per second | `100` |
174207
| `RATE_LIMIT_BURST` | `-rate-limit-burst` | Burst size | `10` |
175208

209+
### Redis Rate Limiting
210+
211+
| Environment Variable | CLI Flag | Description | Default |
212+
|---------------------|----------|-------------|---------|
213+
| `REDIS_ENABLED` | `-redis-enabled` | Enable Redis for distributed rate limiting | `false` |
214+
| `REDIS_ADDR` | `-redis-addr` | Redis server address | `localhost:6379` |
215+
| `REDIS_PASSWORD` | `-redis-password` | Redis password | (empty) |
216+
| `REDIS_DB` | `-redis-db` | Redis database index | `0` |
217+
| `REDIS_KEY_PREFIX` | `-redis-key-prefix` | Redis key prefix for rate limiting | `webhook:ratelimit:` |
218+
| `RATE_LIMIT_WINDOW` | `-rate-limit-window` | Rate limit window (seconds) | `60` |
219+
176220
### HTTP Server Timeouts
177221

178222
| Environment Variable | CLI Flag | Description | Default |
@@ -193,6 +237,25 @@ All command-line parameters can also be set via environment variables:
193237
| `MAX_ARGS_COUNT` | `-max-args-count` | Max argument count | `1000` |
194238
| `STRICT_MODE` | `-strict-mode` | Strict mode | `false` |
195239

240+
### Tracing
241+
242+
| Environment Variable | CLI Flag | Description | Default |
243+
|---------------------|----------|-------------|---------|
244+
| `TRACING_ENABLED` | `-tracing-enabled` | Enable distributed tracing | `false` |
245+
| `OTLP_ENDPOINT` | `-otlp-endpoint` | OTLP exporter endpoint | (empty) |
246+
| `TRACING_SERVICE_NAME` | `-tracing-service-name` | Tracing service name | `webhook` |
247+
248+
### Audit
249+
250+
| Environment Variable | CLI Flag | Description | Default |
251+
|---------------------|----------|-------------|---------|
252+
| `AUDIT_ENABLED` | `-audit-enabled` | Enable audit logging | `false` |
253+
| `AUDIT_STORAGE_TYPE` | `-audit-storage-type` | Audit storage type (file/redis/database) | `file` |
254+
| `AUDIT_FILE_PATH` | `-audit-file-path` | Audit log file path | `./audit.log` |
255+
| `AUDIT_QUEUE_SIZE` | `-audit-queue-size` | Audit async queue size | `1000` |
256+
| `AUDIT_WORKERS` | `-audit-workers` | Audit async workers | `2` |
257+
| `AUDIT_MASK_IP` | `-audit-mask-ip` | Mask IP in audit logs | `true` |
258+
196259
## Security Best Practices
197260

198261
### Command Path Whitelisting

docs/zh-CN/CLI-ENV.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
- `-x-request-id-limit int`
6969
截断 `X-Request-Id` 请求头的长度限制;默认无限制
7070

71+
**说明**:长度限制当前仅能通过 `-x-request-id-limit` 配置;当前实现未提供单独的环境变量。
72+
7173
### 响应头
7274

7375
- `-header value`
@@ -127,6 +129,28 @@
127129
- `-rate-limit-burst int`
128130
设置突发请求的最大数量(默认值:`10`
129131

132+
### Redis 分布式限流
133+
134+
以下参数用于配置基于 Redis 的分布式限流,适用于多实例部署:
135+
136+
- `-redis-enabled`
137+
启用 Redis 分布式限流(默认值:`false`
138+
139+
- `-redis-addr string`
140+
Redis 服务器地址(默认值:`localhost:6379`
141+
142+
- `-redis-password string`
143+
Redis 密码(默认值:空)
144+
145+
- `-redis-db int`
146+
Redis 数据库索引(默认值:`0`
147+
148+
- `-redis-key-prefix string`
149+
限流键前缀(默认值:`webhook:ratelimit:`
150+
151+
- `-rate-limit-window int`
152+
限流时间窗口(秒,默认值:`60`
153+
130154
### HTTP 服务器超时配置
131155

132156
以下参数用于配置 HTTP 服务器的各种超时时间:
@@ -184,6 +208,41 @@
184208

185209
在严格模式下,包含 shell 特殊字符(如 `;`, `|`, `&`, `` ` ``, `$`, `()`, `{}` 等)的参数将被拒绝执行。
186210

211+
### 分布式追踪
212+
213+
以下参数用于配置 OpenTelemetry 分布式追踪:
214+
215+
- `-tracing-enabled`
216+
启用分布式追踪(默认值:`false`
217+
218+
- `-otlp-endpoint string`
219+
OTLP 导出端点(例如 `localhost:4318`,默认值:空)
220+
221+
- `-tracing-service-name string`
222+
追踪服务名称(默认值:`webhook`
223+
224+
### 审计日志
225+
226+
以下参数用于配置审计日志:
227+
228+
- `-audit-enabled`
229+
启用审计日志(默认值:`false`
230+
231+
- `-audit-storage-type string`
232+
审计存储类型:file、redis 或 database(默认值:`file`
233+
234+
- `-audit-file-path string`
235+
审计日志文件路径(当存储类型为 file 时,默认值:`./audit.log`
236+
237+
- `-audit-queue-size int`
238+
异步写入队列大小(默认值:`1000`
239+
240+
- `-audit-workers int`
241+
异步写入工作协程数(默认值:`2`
242+
243+
- `-audit-mask-ip`
244+
在审计日志中脱敏 IP 地址(默认值:`true`
245+
187246
### 其他
188247

189248
- `-version`
@@ -227,9 +286,10 @@
227286
| `MAX_MPART_MEM` | `-max-multipart-mem` | 最大 multipart 内存 | `1048576` |
228287
| `MAX_REQUEST_BODY_SIZE` | `-max-request-body-size` | 最大请求体大小 | `10485760` |
229288
| `X_REQUEST_ID` | `-x-request-id` | 使用 X-Request-Id | `false` |
230-
| `X_REQUEST_ID_LIMIT` | `-x-request-id-limit` | X-Request-Id 长度限制 | `0` |
231289
| `HEADER` | `-header` | 响应头(格式:`name=value`| - |
232290

291+
**说明**:X-Request-Id 长度限制仅能通过 `-x-request-id-limit` 配置,无对应环境变量。
292+
233293
### 进程管理
234294

235295
| 环境变量 | 命令行参数 | 说明 | 默认值 |
@@ -262,6 +322,17 @@
262322
| `RATE_LIMIT_RPS` | `-rate-limit-rps` | 每秒请求数限制 | `100` |
263323
| `RATE_LIMIT_BURST` | `-rate-limit-burst` | 突发请求数限制 | `10` |
264324

325+
### Redis 分布式限流
326+
327+
| 环境变量 | 命令行参数 | 说明 | 默认值 |
328+
|---------|-----------|------|--------|
329+
| `REDIS_ENABLED` | `-redis-enabled` | 启用 Redis 分布式限流 | `false` |
330+
| `REDIS_ADDR` | `-redis-addr` | Redis 服务器地址 | `localhost:6379` |
331+
| `REDIS_PASSWORD` | `-redis-password` | Redis 密码 | (空) |
332+
| `REDIS_DB` | `-redis-db` | Redis 数据库索引 | `0` |
333+
| `REDIS_KEY_PREFIX` | `-redis-key-prefix` | 限流键前缀 | `webhook:ratelimit:` |
334+
| `RATE_LIMIT_WINDOW` | `-rate-limit-window` | 限流时间窗口(秒) | `60` |
335+
265336
### HTTP 服务器超时配置
266337

267338
| 环境变量 | 命令行参数 | 说明 | 默认值 |
@@ -282,6 +353,25 @@
282353
| `MAX_ARGS_COUNT` | `-max-args-count` | 最大参数数量 | `1000` |
283354
| `STRICT_MODE` | `-strict-mode` | 严格模式 | `false` |
284355

356+
### 分布式追踪
357+
358+
| 环境变量 | 命令行参数 | 说明 | 默认值 |
359+
|---------|-----------|------|--------|
360+
| `TRACING_ENABLED` | `-tracing-enabled` | 启用分布式追踪 | `false` |
361+
| `OTLP_ENDPOINT` | `-otlp-endpoint` | OTLP 导出端点 | (空) |
362+
| `TRACING_SERVICE_NAME` | `-tracing-service-name` | 追踪服务名称 | `webhook` |
363+
364+
### 审计日志
365+
366+
| 环境变量 | 命令行参数 | 说明 | 默认值 |
367+
|---------|-----------|------|--------|
368+
| `AUDIT_ENABLED` | `-audit-enabled` | 启用审计日志 | `false` |
369+
| `AUDIT_STORAGE_TYPE` | `-audit-storage-type` | 审计存储类型(file/redis/database) | `file` |
370+
| `AUDIT_FILE_PATH` | `-audit-file-path` | 审计日志文件路径 | `./audit.log` |
371+
| `AUDIT_QUEUE_SIZE` | `-audit-queue-size` | 异步写入队列大小 | `1000` |
372+
| `AUDIT_WORKERS` | `-audit-workers` | 异步写入工作协程数 | `2` |
373+
| `AUDIT_MASK_IP` | `-audit-mask-ip` | 审计日志中脱敏 IP | `true` |
374+
285375
### 环境变量使用示例
286376

287377
```bash

docs/zh-CN/Migration-Guide.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,16 @@ docker run -d \
370370
- 健康检查端点
371371
- 系统指标
372372

373+
### 可观测与合规
374+
375+
本 fork 还支持:
376+
377+
- **分布式追踪(OpenTelemetry/OTLP):** 将追踪数据导出到任意兼容 OTLP 的后端。使用 `-tracing-enabled``-otlp-endpoint``-tracing-service-name`
378+
- **审计日志:** 将 hook 执行与请求记录到 file、Redis 或 database。使用 `-audit-enabled``-audit-storage-type``-audit-file-path` 及相关选项。
379+
- **基于 Redis 的分布式限流:** 在多实例间共享限流状态。使用 `-redis-enabled``-redis-addr``-rate-limit-window` 及相关选项。
380+
381+
完整参数与环境变量说明见 [配置参数](CLI-ENV.md)
382+
373383
---
374384

375385
## 迁移检查清单

0 commit comments

Comments
 (0)