feat: add ip-restriction wasm-go plugin (#759)

This commit is contained in:
renz7
2024-03-12 16:25:44 +08:00
committed by GitHub
parent cc6043de15
commit 3128df9abd
10 changed files with 689 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# 功能说明
`ip-restriction `插件可以通过将 IP 地址列入白名单或黑名单来限制对服务或路由的访问.支持对单个 IP 地址、多个 IP 地址和类似
10.10.10.0/24 的 CIDR范围的限制.
# 配置说明
| 配置项 | 类型 | 必填 | 默认值 | 说明 |
|----------------|--------|----|-----------------------------|------------------------------------------|
| ip_source_type | string | 否 | origin-source | 可选值1. 对端socket ip`origin-source`; 2. 通过header获取`header` |
| ip_header_name | string | 否 | x-forwarded-for | 当`ip_source_type``header`指定自定义IP来源头 |
| allow | array | 否 | [] | 白名单列表 |
| deny | array | 否 | [] | 黑名单列表 |
| status | int | 否 | 403 | 拒绝访问时的 HTTP 状态码 |
| message | string | 否 | Your IP address is blocked. | 拒绝访问时的返回信息 |
```yaml
ip_source_type: origin-source
allow:
- 10.0.0.1
- 192.168.0.0/16
```
```yaml
ip_source_type: header
ip_header_name: x-real-iP
deny:
- 10.0.0.1
- 192.169.0.0/16
```