Skip to content

Commit 6cf5364

Browse files
authored
docs: add TCP connectivity test endpoint to API documentation
1 parent ecdfc1a commit 6cf5364

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

docs/en/api.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ nodepass "master://0.0.0.0:9090/admin?log=info&tls=1"
4949
| `/instances/{id}` | DELETE | Delete instance |
5050
| `/events` | GET | SSE event stream |
5151
| `/info` | GET | Master info |
52+
| `/tcping` | GET | TCP connectivity test |
5253
| `/openapi.json` | GET | OpenAPI spec |
5354
| `/docs` | GET | Swagger UI |
5455

5556
### API Authentication
5657

5758
API Key authentication is enabled by default. The key is auto-generated and stored in `nodepass.gob`.
5859

59-
- Protected: `/instances`, `/instances/{id}`, `/events`, `/info`
60+
- Protected: `/instances`, `/instances/{id}`, `/events`, `/info`, `/tcping`
6061
- Public: `/openapi.json`, `/docs`
6162
- Use header: `X-API-Key: <key>`
6263
- Regenerate: PATCH `/instances/********` with `{ "action": "restart" }`
@@ -633,6 +634,22 @@ await fetch(`${API_URL}/instances/abc123`, {
633634
- **Authentication**: API Key required
634635
- **Response**: Contains system info, version, uptime, etc.
635636

637+
#### GET /tcping
638+
- **Description**: TCP connectivity test to check target reachability and latency
639+
- **Authentication**: API Key required
640+
- **Parameters**:
641+
- `target` (required): Target address in format `host:port`
642+
- **Response**:
643+
```json
644+
{
645+
"target": "example.com:80",
646+
"connected": true,
647+
"latency": 45,
648+
"error": null
649+
}
650+
```
651+
- **Example**: `GET /api/tcping?target=fast.com:443`
652+
636653
#### GET /openapi.json
637654
- **Description**: Get OpenAPI 3.1.1 specification
638655
- **Authentication**: No authentication required

docs/zh/api.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ nodepass "master://0.0.0.0:9090/admin?log=info&tls=1"
4848
| `/instances/{id}` | DELETE | 删除实例 |
4949
| `/events` | GET | SSE 实时事件流 |
5050
| `/info` | GET | 获取主控服务信息 |
51+
| `/tcping` | GET | TCP连接测试 |
5152
| `/openapi.json` | GET | OpenAPI 规范 |
5253
| `/docs` | GET | Swagger UI 文档 |
5354

5455
### API 鉴权
5556

5657
API Key 认证默认启用,首次启动自动生成并保存在 `nodepass.gob`
5758

58-
- 受保护接口:`/instances``/instances/{id}``/events``/info`
59+
- 受保护接口:`/instances``/instances/{id}``/events``/info``/tcping`
5960
- 公共接口:`/openapi.json``/docs`
6061
- 认证方式:请求头加 `X-API-Key: <key>`
6162
- 重置 Key:PATCH `/instances/********`,body `{ "action": "restart" }`
@@ -1009,6 +1010,22 @@ await fetch(`${API_URL}/instances/abc123`, {
10091010
- **认证**:需要API Key
10101011
- **响应**:包含系统信息、版本、运行时间等
10111012
1013+
#### GET /tcping
1014+
- **描述**:TCP连接测试,检测目标地址的连通性和延迟
1015+
- **认证**:需要API Key
1016+
- **参数**:
1017+
- `target`(必需):目标地址,格式为 `host:port`
1018+
- **响应**:
1019+
```json
1020+
{
1021+
"target": "example.com:80",
1022+
"connected": true,
1023+
"latency": 45,
1024+
"error": null
1025+
}
1026+
```
1027+
- **示例**:`GET /api/tcping?target=fast.com:443`
1028+
10121029
#### GET /openapi.json
10131030
- **描述**:获取OpenAPI 3.1.1规范
10141031
- **认证**:无需认证

0 commit comments

Comments
 (0)