itecdn 5.x / 用户 API
获取四层转发详情
GET
/v1/streams/{stream_id}获取指定四层转发的完整配置、套餐、线路和任务状态。普通用户仅能查看自己的转发;查询其他用户的转发需要管理员权限。监听、源站和 ACL 等配置字段按数据库原值以 JSON 字符串返回。
身份认证
access-token
api-key + api-secret
认证定义
{
"AccessToken": {
"type": "apiKey",
"in": "header",
"name": "access-token",
"description": "通过登录接口获得的短期访问令牌。"
},
"ApiKey": {
"type": "apiKey",
"in": "header",
"name": "api-key",
"description": "API Key;必须和 api-secret 同时发送。"
},
"ApiSecret": {
"type": "apiKey",
"in": "header",
"name": "api-secret",
"description": "API Secret;必须和 api-key 同时发送。"
}
}请求参数
| 参数 | 位置 | 类型 | 必填 | 说明与约束 |
|---|---|---|---|---|
stream_id | path | integer | 必填 | 要查询的四层转发 ID;必须存在且当前用户有权限查看。 完整参数定义 |
响应
HTTP 200
请求已被处理。成功时 code 为 0、msg 为空字符串、data 为转发详情;转发不存在或无权限时仍返回 HTTP 200。
application/json
object
| 字段 | 类型 | 必填 | 说明与约束 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code | integer | 必填 | 业务状态码;成功为 0。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
msg | string | 必填 | 成功时为空字符串,失败时为错误说明。 约束 / 默认值 / 示例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data | object | 必填 | 四层转发详情。配置字段为 JSON 字符串。 约束 / 默认值 / 示例展开字段结构四层转发详情。配置字段为 JSON 字符串。
|
完整 Schema
{
"type": "object",
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "业务状态码;成功为 0。",
"example": 0
},
"msg": {
"type": "string",
"description": "成功时为空字符串,失败时为错误说明。",
"example": ""
},
"data": {
"type": "object",
"description": "四层转发详情。配置字段为 JSON 字符串。",
"required": [
"id",
"uid",
"listen",
"backend",
"enable",
"stream_state"
],
"properties": {
"id": {
"type": "integer",
"description": "转发 ID。"
},
"uid": {
"type": "integer",
"description": "归属用户 ID。"
},
"name": {
"type": "string",
"description": "归属用户名。"
},
"des": {
"type": "string",
"description": "转发备注。"
},
"listen": {
"type": "string",
"description": "监听配置 JSON 字符串。"
},
"backend": {
"type": "string",
"description": "源站配置 JSON 字符串。"
},
"backend_port": {
"type": "integer",
"description": "回源端口。"
},
"balance_way": {
"type": "string",
"description": "负载均衡方式。"
},
"proxy_protocol": {
"type": "integer",
"description": "是否启用 PROXY protocol。"
},
"conn_limit": {
"type": "integer",
"nullable": true,
"description": "连接数限制。"
},
"acl": {
"type": "string",
"nullable": true,
"description": "访问控制配置 JSON 字符串。"
},
"block_region": {
"type": "string",
"description": "地域拦截配置。"
},
"enable": {
"type": "integer",
"enum": [
0,
1
],
"description": "是否启用。"
},
"stream_state": {
"type": "string",
"description": "转发自身状态。"
},
"sync_state": {
"type": "string",
"nullable": true,
"description": "同步任务状态。"
},
"task_id": {
"type": "integer",
"nullable": true,
"description": "同步任务 ID。"
},
"user_package": {
"type": "integer",
"description": "用户套餐 ID。"
},
"package_name": {
"type": "string",
"description": "用户套餐名称。"
},
"end_at": {
"type": "string",
"nullable": true,
"description": "套餐到期时间。"
},
"region_id": {
"type": "integer",
"description": "区域 ID。"
},
"region_name": {
"type": "string",
"description": "区域名称。"
},
"node_group_id": {
"type": "integer",
"description": "主线路组 ID。"
},
"node_group_name": {
"type": "string",
"description": "主线路组名称。"
},
"node_group_ipv6": {
"type": "integer",
"enum": [
0,
1
],
"description": "主线路组是否有 IPv6 节点。"
},
"backup_node_group": {
"type": "integer",
"nullable": true,
"description": "备用线路组 ID。"
},
"backup_node_group_name": {
"type": "string",
"nullable": true,
"description": "备用线路组名称。"
},
"enable_backup_group": {
"type": "integer",
"description": "是否启用备用线路组。"
},
"enable_ipv6": {
"type": "integer",
"description": "是否启用 IPv6。"
},
"cname_mode": {
"type": "string",
"description": "CNAME 使用方式。"
},
"cname_hostname": {
"type": "string",
"description": "CNAME 主机名。"
},
"cname_domain": {
"type": "string",
"nullable": true,
"description": "转发 CNAME 域名。"
},
"up_cname_domain": {
"type": "string",
"nullable": true,
"description": "套餐 CNAME 域名。"
},
"up_cname_hostname": {
"type": "string",
"nullable": true,
"description": "套餐 CNAME 主机名。"
},
"cname_task_id": {
"type": "integer",
"nullable": true,
"description": "CNAME 任务 ID。"
},
"cname_state": {
"type": "string",
"nullable": true,
"description": "CNAME 任务状态。"
},
"groups": {
"type": "string",
"nullable": true,
"description": "关联转发组 ID 的逗号分隔字符串。"
},
"create_at2": {
"type": "string",
"description": "创建时间。"
},
"update_at2": {
"type": "string",
"description": "更新时间。"
},
"version": {
"type": "integer",
"description": "配置版本号。"
}
}
}
}
}示例
{
"code": 0,
"msg": "",
"data": {
"id": 101,
"uid": 12,
"listen": "[{\"port\":443,\"protocol\":\"tcp\"}]",
"backend": "[{\"addr\":\"198.51.100.10\",\"weight\":1,\"state\":\"up\"}]",
"enable": 1,
"stream_state": "done"
}
}查询成功
{
"code": 0,
"msg": "",
"data": {
"id": 101,
"uid": 12,
"listen": "[{\"port\":443,\"protocol\":\"tcp\"}]",
"backend": "[{\"addr\":\"198.51.100.10\",\"weight\":1,\"state\":\"up\"}]",
"enable": 1,
"stream_state": "done"
}
}转发不存在
{
"code": "stream-58",
"msg": "转发不存在",
"data": ""
}cURL 示例
根据文档生成;请替换主控地址、路径参数和凭证,并按上表补充查询参数。
curl --request GET \
"https://master.example.invalid/v1/streams/{stream_id}" \
--header "access-token: YOUR_ACCESS_TOKEN"