You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/07/07 03:11:34 UTC

[GitHub] [apisix] hf400159 commented on a diff in pull request #7402: docs: refactor ip-restriction.md

hf400159 commented on code in PR #7402:
URL: https://github.com/apache/apisix/pull/7402#discussion_r915402260


##########
docs/zh/latest/plugins/ip-restriction.md:
##########
@@ -77,29 +88,62 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 
 ## 测试插件
 
-通过 `127.0.0.1` 访问:
+启用插件后,使用 curl 命令先从 IP 地址 `127.0.0.1` 发出请求:
+
+```shell
+curl http://127.0.0.1:9080/index.html -i
+```
+
+返回 200 HTTP 状态码,代表访问成功:
 
 ```shell
-$ curl http://127.0.0.1:9080/index.html -i
 HTTP/1.1 200 OK
 ...
 ```
 
-通过 `127.0.0.2` 访问:
+再从 IP 地址 `127.0.0.2` 发出请求:
+
+```shell
+curl http://127.0.0.1:9080/index.html -i --interface 127.0.0.2
+```
+
+返回 403 HTTP 状态码,代表访问被阻止:

Review Comment:
   ```suggestion
   返回 `403` HTTP 状态码,代表访问被阻止:
   ```



##########
docs/zh/latest/plugins/ip-restriction.md:
##########
@@ -23,22 +29,27 @@ title: ip-restriction
 
 ## 描述
 
-`ip-restriction` 可以通过以下方式限制对服务或路线的访问,将 IP 地址列入白名单或黑名单。 单个 IP 地址,多个 IP 地址 或 CIDR 范围,可以使用类似 10.10.10.0/24 的 CIDR 表示法。
+`ip-restriction` 插件可以通过将 IP 地址列入白名单或黑名单来限制对服务或路由的访问。
+
+支持对单个 IP 地址,多个 IP 地址和类似 `10.10.10.0/24` 的 CIDR(Classless InterDomain Routing,无类域间路由)范围的限制。
 
 ## 属性
 
-| 参数名    | 类型          | 可选项 | 默认值 | 有效值 | 描述                             |
+| 参数名    | 类型          | 必选项 | 默认值 | 有效值 | 描述                             |
 | --------- | ------------- | ------ | ------ | ------ | -------------------------------- |
-| whitelist | array[string] | 可选   |        |        | 加入白名单的 IP 地址或 CIDR 范围 |
-| blacklist | array[string] | 可选   |        |        | 加入黑名单的 IP 地址或 CIDR 范围 |
-| message | string | 可选   | Your IP address is not allowed. | [1, 1024] | 在未允许的 IP 访问的情况下返回的信息 |
+| whitelist | array[string] | 否   |        |        | 加入白名单的 IP 地址或 CIDR 范围。 |
+| blacklist | array[string] | 否   |        |        | 加入黑名单的 IP 地址或 CIDR 范围。 |
+| message | string | 否   | "Your IP address is not allowed" | [1, 1024] | 在未允许的 IP 访问的情况下返回的信息。 |
+
+:::note
+
+必须指定 `whitelist` 或 `blacklist` 属性之一,且两个属性不能一起使用。

Review Comment:
   ```suggestion
   `whitelist` 和 `blacklist` 属性无法同时在同一个服务或路由上使用,只能使用其中之一。
   ```



##########
docs/zh/latest/plugins/ip-restriction.md:
##########
@@ -77,29 +88,62 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13
 
 ## 测试插件
 
-通过 `127.0.0.1` 访问:
+启用插件后,使用 curl 命令先从 IP 地址 `127.0.0.1` 发出请求:
+
+```shell
+curl http://127.0.0.1:9080/index.html -i
+```
+
+返回 200 HTTP 状态码,代表访问成功:
 
 ```shell
-$ curl http://127.0.0.1:9080/index.html -i
 HTTP/1.1 200 OK
 ...
 ```
 
-通过 `127.0.0.2` 访问:
+再从 IP 地址 `127.0.0.2` 发出请求:
+
+```shell
+curl http://127.0.0.1:9080/index.html -i --interface 127.0.0.2
+```
+
+返回 403 HTTP 状态码,代表访问被阻止:
 
 ```shell
-$ curl http://127.0.0.1:9080/index.html -i --interface 127.0.0.2
 HTTP/1.1 403 Forbidden
 ...
 {"message":"Your IP address is not allowed"}
 ```
 
+要更改列入白名单或黑名单的 IP 地址,你只需更新插件配置,无需重启服务:

Review Comment:
   ```suggestion
   如果你需要更改白名单或黑名单的 IP 地址,你只需更新插件配置,无需重启服务:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org