# 带宽规则

# 获取带宽规则列表

# 简介

获取指定分页的带宽规则列表。

# URI

GET /admin-api/socks5_proxy/{id}/bandwidth_rules

# URI 参数

  • detail

    type: integer

    required: no

    description: 获取详细的 DNS 应用信息

  • page

    type: integer

    required: no

    description: 第几页,从 1 开始

  • page_size

    type: integer

    required: no

    description: 每页大小,默认 20

# 请求示例

# Shell

curl http://{admin-site}/admin-api/socks5_proxy/3/bandwidth_rules?page=1&page_size=20&detail=1

# 响应示例

Status: 200 OK
{
    "data": [
        {
            "_modified_unix": 1621839010.1792,
            "connections": 30,
            "_created_unix": 1621839010.1792,
            "src_type": "user",
            "bandwidth": 30,
            "id": 2,
            "enabled": true,
            "src": [
                "abc"
            ],
            "order": 0
        }
    ],
    "status": 0
}

# 添加带宽规则

# 简介

添加带宽规则。

# URI

POST /admin-api/socks5_proxy/{id}/bandwidth_rules

# JSON Body 参数

  • enabled

    type: boolean

    required: no

    description: 启用/禁用

  • connections

    type: integer

    required: yes

    description: 连接数

  • src_type

    type: string

    required: yes

    description: 源类型, 取值:user、group、cidr

  • src

    type: string

    required: yes

    description: 源

  • bandwidth

    type: integer

    required: yes

    description: 带宽

# 请求示例

# Shell

curl -X POST http://{admin-site}/admin-api/socks5_proxy/{id}/bandwidth_rules -d
'{
    "enabled": true,
    "connections": 30,
    "bandwidth": 30,
    "src": [
        "abc"
    ],
    "src_type": "user"
}'

# 响应示例

Status: 200 OK
{
    "status": 0,
    "data": {
        "id": 1
    }
}

# 修改带宽规则

# 简介

修改带宽规则。

# URI

PUT /admin-api/socks5_proxy/{id}/bandwidth_rules/{id}

# JSON Body 参数

  • enabled

    type: boolean

    required: no

    description: 启用/禁用

  • connections

    type: integer

    required: yes

    description: 连接数

  • src_type

    type: string

    required: yes

    description: 源类型, 取值:user、group、cidr

  • src

    type: string

    required: yes

    description: 源

  • bandwidth

    type: integer

    required: yes

    description: 带宽

# 请求示例

# Shell

curl -X PUT http://{admin-site}/admin-api/socks5_proxy/{id}/bandwidth_rules/{id} -d
'{
    "_modified_unix": 1621839010.1792,
    "connections": 34,
    "_created_unix": 1621839010.1792,
    "bandwidth": 30,
    "id": 2,
    "enabled": true,
    "order": 0,
    "src": [
        "abc"
    ],
    "src_type": "group"
}'

# 响应示例

Status: 200 OK
{
    "status": 0
}

# 删除带宽规则

# 简介

删除带宽规则。

# URI

DELETE /admin-api/socks5_proxy/{id}/bandwidth_rules/{id}

# 请求示例

# Shell

curl -X DELETE http://{admin-site}/admin-api/socks5_proxy/{id}/bandwidth_rules/{id}

# 响应示例

Status: 200 OK
{
    "status": 0
}