# IPLibraryService
> IP库

---

## createIPLibrary
> 创建IP库

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/IPLibraryService/createIPLibrary`
- RPC：`rpc createIPLibrary (CreateIPLibraryRequest) returns (CreateIPLibraryResponse) {
		option deprecated = true;
	};

	// 查找最新的IP库
	rpc findLatestIPLibraryWithType (FindLatestIPLibraryWithTypeRequest) returns (FindLatestIPLibraryWithTypeResponse) {
		option deprecated = true;
	};

	// 查找单个IP库
	rpc findEnabledIPLibrary (FindEnabledIPLibraryRequest) returns (FindEnabledIPLibraryResponse) {
		option deprecated = true;
	};

	// 列出某个类型的所有IP库
	rpc findAllEnabledIPLibrariesWithType (FindAllEnabledIPLibrariesWithTypeRequest) returns (FindAllEnabledIPLibrariesWithTypeResponse) {
		option deprecated = true;
	};

	// 删除IP库
	rpc deleteIPLibrary (DeleteIPLibraryRequest) returns (RPCSuccess) {
		option deprecated = true;
	};`

**请求对象 (`CreateIPLibraryRequest`)**

```json
{
  "type": "string",
  "fileId": "int64 // 文件ID"
}
```

**响应对象 (`CreateIPLibraryResponse`)**

```json
{
  "ipLibraryId": "int64"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/IPLibraryService/createIPLibrary" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## lookupIPRegion
> 查询某个IP信息

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/IPLibraryService/lookupIPRegion`
- RPC：`rpc lookupIPRegion (LookupIPRegionRequest) returns (LookupIPRegionResponse);`

**请求对象 (`LookupIPRegionRequest`)**

```json
{
  "ip": "string"
}
```

**响应对象 (`LookupIPRegionResponse`)**

```json
{
  "ipRegion": "IPRegion"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/IPLibraryService/lookupIPRegion" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## lookupIPRegions
> 查询一组IP信息

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/IPLibraryService/lookupIPRegions`
- RPC：`rpc lookupIPRegions (LookupIPRegionsRequest) returns (LookupIPRegionsResponse);`

**请求对象 (`LookupIPRegionsRequest`)**

```json
{
  "ipList": "[]string"
}
```

**响应对象 (`LookupIPRegionsResponse`)**

```json
{
  "ipRegionMap": "map"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/IPLibraryService/lookupIPRegions" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
