# NSClusterService
> 域名服务集群相关服务

---

## countAllNSClusters
> 计算所有可用集群的数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/countAllNSClusters`
- RPC：`rpc countAllNSClusters (CountAllNSClustersRequest) returns (RPCCountResponse);`

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

```json
{}
```

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

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

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

---

## countAllNSClustersWithSSLCertId
> 计算使用某个SSL证书的集群数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/countAllNSClustersWithSSLCertId`
- RPC：`rpc countAllNSClustersWithSSLCertId (CountAllNSClustersWithSSLCertIdRequest) returns (RPCCountResponse);`

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

```json
{
  "sslCertId": "int64"
}
```

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

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

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

---

## createNSCluster
> 创建集群

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/createNSCluster`
- RPC：`rpc createNSCluster (CreateNSClusterRequest) returns (CreateNSClusterResponse);`

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

```json
{
  "name": "string // 名称",
  "accessLogJSON": "bytes",
  "hosts": "[]string",
  "soaJSON": "bytes",
  "email": "string"
}
```

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

```json
{
  "nsClusterId": "int64"
}
```

**调用示例**

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

---

## deleteNSCluster
> 删除集群

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/deleteNSCluster`
- RPC：`rpc deleteNSCluster (DeleteNSCluster) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllNSClusters
> 查找所有可用集群

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findAllNSClusters`
- RPC：`rpc findAllNSClusters (FindAllNSClustersRequest) returns (FindAllNSClustersResponse);`

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

```json
{}
```

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

```json
{
  "nsClusters": "[]NSCluster"
}
```

**调用示例**

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

---

## findAvailableNSHostsForUser
> 查找用户可以使用的主机地址

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findAvailableNSHostsForUser`
- RPC：`rpc findAvailableNSHostsForUser(FindAvailableNSHostsForUserRequest) returns (FindAvailableNSHostsForUserResponse);`

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

```json
{
  "userId": "int64 // 用户ID"
}
```

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

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

**调用示例**

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

---

## findNSCluster
> 查找单个可用集群信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSCluster`
- RPC：`rpc findNSCluster (FindNSClusterRequest) returns (FindNSClusterResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "nsCluster": "NSCluster"
}
```

**调用示例**

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

---

## findNSClusterAccessLog
> 查找集群访问日志配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterAccessLog`
- RPC：`rpc findNSClusterAccessLog (FindNSClusterAccessLogRequest) returns (FindNSClusterAccessLogResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "AccessLogJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterAnswerConfig
> 查找应答模式

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterAnswerConfig`
- RPC：`rpc findNSClusterAnswerConfig(FindNSClusterAnswerConfigRequest) returns (FindNSClusterAnswerConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "answerJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterDDoSProtection
> 获取NS集群的DDoS设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterDDoSProtection`
- RPC：`rpc findNSClusterDDoSProtection(FindNSClusterDDoSProtectionRequest) returns (FindNSClusterDDoSProtectionResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "ddosProtectionJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterDoHConfig
> 查找集群的DoH设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterDoHConfig`
- RPC：`rpc findNSClusterDoHConfig(FindNSClusterDoHConfigRequest) returns (FindNSClusterDoHConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "dohJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterHosts
> 查找NS集群的主机地址

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterHosts`
- RPC：`rpc findNSClusterHosts(FindNSClusterHostsRequest) returns (FindNSClusterHostsResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

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

**调用示例**

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

---

## findNSClusterRecursionConfig
> 读取递归DNS配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterRecursionConfig`
- RPC：`rpc findNSClusterRecursionConfig(FindNSClusterRecursionConfigRequest) returns (FindNSClusterRecursionConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "recursionJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterSOAConfig
> 查找SOA配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterSOAConfig`
- RPC：`rpc findNSClusterSOAConfig(FindNSClusterSOAConfigRequest) returns (FindNSClusterSOAConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "soaJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterTCPConfig
> 查找集群的TCP设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterTCPConfig`
- RPC：`rpc findNSClusterTCPConfig(FindNSClusterTCPConfigRequest) returns (FindNSClusterTCPConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "tcpJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterTLSConfig
> 查找集群的TLS设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterTLSConfig`
- RPC：`rpc findNSClusterTLSConfig(FindNSClusterTLSConfigRequest) returns (FindNSClusterTLSConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "tlsJSON": "bytes"
}
```

**调用示例**

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

---

## findNSClusterUDPConfig
> 查找集群的UDP设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/findNSClusterUDPConfig`
- RPC：`rpc findNSClusterUDPConfig(FindNSClusterUDPConfigRequest) returns (FindNSClusterUDPConfigResponse);`

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

```json
{
  "nsClusterId": "int64"
}
```

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

```json
{
  "udpJSON": "bytes"
}
```

**调用示例**

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

---

## listNSClusters
> 列出单页可用集群

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/listNSClusters`
- RPC：`rpc listNSClusters (ListNSClustersRequest) returns (ListNSClustersResponse);`

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

```json
{
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "nsClusters": "[]NSCluster"
}
```

**调用示例**

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

---

## updateNSCluster
> 修改集群

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSCluster`
- RPC：`rpc updateNSCluster (UpdateNSClusterRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "name": "string // 名称",
  "isOn": "bool // 是否启用",
  "hosts": "[]string",
  "email": "string",
  "autoRemoteStart": "bool",
  "timeZone": "string",
  "detectAgents": "bool",
  "checkingPorts": "bool // 是否检查端口连通性（目前仅在节点列表上）"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterAccessLog
> 修改集群访问日志配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterAccessLog`
- RPC：`rpc updateNSClusterAccessLog (UpdateNSClusterAccessLogRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "accessLogJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterAnswerConfig
> 设置应答模式

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterAnswerConfig`
- RPC：`rpc updateNSClusterAnswerConfig(UpdateNSClusterAnswerConfigRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "answerJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterDDoSProtection
> 修改NS集群的DDoS设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterDDoSProtection`
- RPC：`rpc updateNSClusterDDoSProtection(UpdateNSClusterDDoSProtectionRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "ddosProtectionJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterDoH
> 修改集群的DoH设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterDoH`
- RPC：`rpc updateNSClusterDoH (UpdateNSClusterDoHRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "dohJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterRecursionConfig
> 设置递归DNS配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterRecursionConfig`
- RPC：`rpc updateNSClusterRecursionConfig(UpdateNSClusterRecursionConfigRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "recursionJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterSOAConfig
> 设置SOA配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterSOAConfig`
- RPC：`rpc updateNSClusterSOAConfig(UpdateNSClusterSOAConfigRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "soaJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterTCP
> 修改集群的TCP设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterTCP`
- RPC：`rpc updateNSClusterTCP (UpdateNSClusterTCPRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "tcpJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterTLS
> 修改集群的TLS设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterTLS`
- RPC：`rpc updateNSClusterTLS (UpdateNSClusterTLSRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "tlsJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSClusterUDP
> 修改集群的UDP设置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSClusterService/updateNSClusterUDP`
- RPC：`rpc updateNSClusterUDP (UpdateNSClusterUDPRequest) returns (RPCSuccess);`

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

```json
{
  "nsClusterId": "int64",
  "udpJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---
