Skip to content

隧道管理 API

基础信息

  • 接口地址: /proxy
  • 请求方式: POST
  • Content-Type: application/json;charset=UTF-8

API 列表

序号接口type 值功能
1添加隧道add创建新隧道
2编辑隧道edit修改隧道配置
3删除隧道remove删除隧道
4列出隧道list获取隧道列表
5获取配置config获取配置文件
6切换状态toggle启用/禁用隧道
7检查状态check检查隧道在线状态
8强制下线forcedown强制下线隧道

1. 添加隧道

type: add

json
{
    "type": "add",
    "csrf": "Token值",
    "proxy_name": "隧道名称",
    "proxy_type": "tcp/udp/http/https/xtcp/stcp",
    "local_ip": "127.0.0.1",
    "local_port": 端口,
    "remote_port": 端口,
    "use_encryption": "true/false",
    "use_compression": "true/false",
    "sk": "连接密钥(P2P用)",
    "node": "节点ID",
    "domain": "域名(HTTP(S)用)"
}

2. 编辑隧道

type: edit

json
{
    "type": "edit",
    "csrf": "Token值",
    "id": "隧道ID",
    "proxy_name": "隧道名称",
    "proxy_type": "tcp/udp/http/https/xtcp/stcp",
    "local_ip": "127.0.0.1",
    "local_port": 端口,
    "remote_port": 端口,
    "use_encryption": "true/false",
    "use_compression": "true/false",
    "node": "节点ID"
}

3. 删除隧道

type: remove

json
{
    "type": "remove",
    "csrf": "Token值",
    "id": "隧道ID"
}

4. 列出隧道

type: list

json
{
    "type": "list",
    "csrf": "Token值",
    "id": "隧道ID(可选,不填则返回全部)"
}

返回:

json
{
    "status": 200,
    "proxies": [
        {
            "id": "隧道ID",
            "proxy_name": "隧道名称",
            "proxy_type": "tcp/udp/http/https/xtcp/stcp",
            "local_ip": "本地IP",
            "local_port": "本地端口",
            "remote_port": "远程端口",
            "use_encryption": "true/false",
            "use_compression": "true/false",
            "status": "true/false",
            "node": "节点ID",
            "node_name": "节点名称",
            "node_domain": "节点域名"
        }
    ]
}

5. 获取配置文件

type: config

json
{
    "type": "config",
    "format": "ini/toml",
    "csrf": "Token值",
    "node": "节点ID或隧道ID"
}

6. 切换隧道状态

type: toggle

json
{
    "type": "toggle",
    "csrf": "Token值",
    "id": "隧道ID",
    "toggle": "true/false"
}

7. 检查隧道状态

type: check

json
{
    "type": "check",
    "csrf": "Token值",
    "id": "隧道ID"
}

返回:

json
{
    "status": 200,  // 200在线, 500离线
    "message": "隧道在线.",
    "ostatus": "online/offline"
}

8. 强制下线

type: forcedown

json
{
    "type": "forcedown",
    "csrf": "Token值",
    "id": "隧道ID"
}

隧道类型说明

类型说明
tcpTCP 隧道
udpUDP 隧道
httpHTTP 隧道
httpsHTTPS 隧道
xtcpP2P TCP 隧道
stcpP2P STCP 隧道

基于 MIT 许可证发布