黑名单

黑名单

GET /api/v4/banned

获取黑名单

Query String Parameters:

同 /api/v4/clients。

Success Response Body (JSON):

Name Type Description
code Integer 0
data Array 由对象构成的数组,对象中的字段与 POST 方法中的 Request Body 相同
meta Object 同 /api/v4/clients

Examples:

获取黑名单列表:

$ curl -i --basic -u admin:public -vX GET "http://localhost:8081/api/v4/banned"

{"meta":{"page":1,"limit":10000,"count":1},"data":[{"who":"example","until":1582265833,"reason":"undefined","by":"user","at":1582265533,"as":"clientid"}],"code":0}

POST /api/v4/banned

将对象添加至黑名单

Parameters (json):

Name Type Required Default Description
who String Required 添加至黑名单的对象,可以是客户端标识符、用户名和 IP 地址
as String Required 用于区分黑名单对象类型,可以是 clientid,username,peerhost
by String Optional user 指示该对象被谁添加至黑名单
at Integer Optional 当前系统时间 添加至黑名单的时间,单位:秒
until Integer Optional 当前系统时间 + 5 分钟 何时从黑名单中解除,单位:秒

Success Response Body (JSON):

Name Type Description
code Integer 0
data Object 与传入的 Request Body 相同

Examples:

将 client 添加到黑名单:

$ curl -i --basic -u admin:public -vX POST "http://localhost:8081/api/v4/banned" -d '{"who":"example","as":"clientid"}'

{"data":{"who":"example","as":"clientid"},"code":0}

DELETE /api/v4/banned/{as}/{who}

将对象从黑名单中删除

Parameters: 无

Success Response Body (JSON):

Name Type Description
code Integer 0
message String 仅在发生错误时返回,用于提供更详细的错误信息

Examples:

将 client 从黑名单中移除:

$ curl -i --basic -u admin:public -X DELETE "http://localhost:8081/api/v4/banned/clientid/example"

{"code":0}