378 lines
6.8 KiB
Markdown
378 lines
6.8 KiB
Markdown
# IPListService
|
||
> IP列表
|
||
|
||
---
|
||
|
||
## countAllEnabledIPLists
|
||
> 计算名单数量
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/countAllEnabledIPLists`
|
||
- RPC:`rpc countAllEnabledIPLists (CountAllEnabledIPListsRequest) returns (RPCCountResponse);`
|
||
|
||
**请求对象 (`CountAllEnabledIPListsRequest`)**
|
||
|
||
```json
|
||
{
|
||
"type": "string",
|
||
"isPublic": "bool",
|
||
"keyword": "string // 关键词"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCCountResponse`)**
|
||
|
||
```json
|
||
{
|
||
"count": "int64 // 数量"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/countAllEnabledIPLists" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## createIPList
|
||
> 创建IP列表
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/createIPList`
|
||
- RPC:`rpc createIPList (CreateIPListRequest) returns (CreateIPListResponse);`
|
||
|
||
**请求对象 (`CreateIPListRequest`)**
|
||
|
||
```json
|
||
{
|
||
"type": "string",
|
||
"name": "string // 名称",
|
||
"code": "string",
|
||
"timeoutJSON": "bytes",
|
||
"isPublic": "bool",
|
||
"description": "string // 描述(备注)",
|
||
"isGlobal": "bool",
|
||
"serverId": "int64 // 服务ID(网站ID)"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`CreateIPListResponse`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/createIPList" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## deleteIPList
|
||
> 删除IP名单
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/deleteIPList`
|
||
- RPC:`rpc deleteIPList (DeleteIPListRequest) returns (RPCSuccess);`
|
||
|
||
**请求对象 (`DeleteIPListRequest`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCSuccess`)**
|
||
|
||
```json
|
||
{}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/deleteIPList" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## existsEnabledIPList
|
||
> 检查IPList是否存在
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/existsEnabledIPList`
|
||
- RPC:`rpc existsEnabledIPList (ExistsEnabledIPListRequest) returns (ExistsEnabledIPListResponse);`
|
||
|
||
**请求对象 (`ExistsEnabledIPListRequest`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`ExistsEnabledIPListResponse`)**
|
||
|
||
```json
|
||
{
|
||
"exists": "bool"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/existsEnabledIPList" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findEnabledIPList
|
||
> 查找IP列表信息
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/findEnabledIPList`
|
||
- RPC:`rpc findEnabledIPList (FindEnabledIPListRequest) returns (FindEnabledIPListResponse);`
|
||
|
||
**请求对象 (`FindEnabledIPListRequest`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindEnabledIPListResponse`)**
|
||
|
||
```json
|
||
{
|
||
"ipList": "IPList"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/findEnabledIPList" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findEnabledIPListContainsIP
|
||
> 根据IP来搜索IP名单
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/findEnabledIPListContainsIP`
|
||
- RPC:`rpc findEnabledIPListContainsIP(FindEnabledIPListContainsIPRequest) returns (FindEnabledIPListContainsIPResponse);`
|
||
|
||
**请求对象 (`FindEnabledIPListContainsIPRequest`)**
|
||
|
||
```json
|
||
{
|
||
"ip": "string"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindEnabledIPListContainsIPResponse`)**
|
||
|
||
```json
|
||
{
|
||
"ipLists": "[]IPList"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/findEnabledIPListContainsIP" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findIPListIdWithCode
|
||
> 根据IP名单代号获取IP名单ID
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/findIPListIdWithCode`
|
||
- RPC:`rpc findIPListIdWithCode(FindIPListIdWithCodeRequest) returns (FindIPListIdWithCodeResponse);`
|
||
|
||
**请求对象 (`FindIPListIdWithCodeRequest`)**
|
||
|
||
```json
|
||
{
|
||
"code": "string // IP名单代号"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindIPListIdWithCodeResponse`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64 // IP名单ID"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/findIPListIdWithCode" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findServerIdWithIPListId
|
||
> 查找IP名单对应的网站ID
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/findServerIdWithIPListId`
|
||
- RPC:`rpc findServerIdWithIPListId(FindServerIdWithIPListIdRequest) returns (FindServerIdWithIPListIdResponse);`
|
||
|
||
**请求对象 (`FindServerIdWithIPListIdRequest`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64 // IP名单ID"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindServerIdWithIPListIdResponse`)**
|
||
|
||
```json
|
||
{
|
||
"serverId": "int64 // 网站ID(如果是公共IP名单,则对应的网站ID为0)"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/findServerIdWithIPListId" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## listEnabledIPLists
|
||
> 列出单页名单
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/listEnabledIPLists`
|
||
- RPC:`rpc listEnabledIPLists (ListEnabledIPListsRequest) returns (ListEnabledIPListsResponse);`
|
||
|
||
**请求对象 (`ListEnabledIPListsRequest`)**
|
||
|
||
```json
|
||
{
|
||
"type": "string",
|
||
"isPublic": "bool",
|
||
"keyword": "string // 关键词",
|
||
"offset": "int64 // 读取位置",
|
||
"size": "int64 // 数量,通常不能小于0"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`ListEnabledIPListsResponse`)**
|
||
|
||
```json
|
||
{
|
||
"ipLists": "[]IPList"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/listEnabledIPLists" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## updateIPList
|
||
> 修改IP列表
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/IPListService/updateIPList`
|
||
- RPC:`rpc updateIPList (UpdateIPListRequest) returns (RPCSuccess);`
|
||
|
||
**请求对象 (`UpdateIPListRequest`)**
|
||
|
||
```json
|
||
{
|
||
"ipListId": "int64",
|
||
"name": "string // 名称",
|
||
"code": "string",
|
||
"timeoutJSON": "bytes",
|
||
"description": "string // 描述(备注)"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCSuccess`)**
|
||
|
||
```json
|
||
{}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/IPListService/updateIPList" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|