授权规则
获取授权规则列表
URI
GET /admin-api/socks5_proxy/{id}/auth_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/auth_rules?page=1&page_size=20&detail=1
响应示例
Status: 200 OK
{
"data": [
{
"_modified_unix": 1621832319.6485,
"dst_type": "-",
"lua": "local _M = {}\n\n--[[\n Entry point of Lua rule\n @config: config of socks5 application\n @rule: socks5 rule that includes this Lua code\n return: true, false, nil and error message\n]]\nfunction _M.run(config, rule)\n -- do something\n return true\nend\n\nreturn _M",
"start_time": 1621832280,
"id": 2,
"rule_type": "basic",
"dst": [
"-"
],
"src_type": "-",
"bandwidth": 30,
"enabled": true,
"type": "permit",
"end_time": 1621832280,
"src": [
"-"
],
"_created_unix": 1621832319.6485,
"order": 0
}
],
"status": 0
}
添加授权规则
URI
POST /admin-api/socks5_proxy/{id}/auth_rules
JSON Body 参数
enabled
type: boolean
required: no
description: 启用/禁用
type
type: string
required: yes
description: 动作类型,permit 或 deny
rule_type
type: string
required: yes
description: 规则类型,lua 或 basic
bandwidth
type: integer
required: yes
description: 带宽
start_time
type: integer
required: yes
description: 规则有效起始时间
end_time
type: integer
required: yes
description: 规则有效结束时间
dst_port
type: integer
required: no
description: 目标端口
src
type: string
required: yes
description: 源
dst
type: string
required: yes
description: 目标
请求示例
Shell
curl -X POST http://{admin-site}/admin-api/socks5_proxy/{id}/auth_rules -d
'
{
"enabled": true,
"type": "permit",
"rule_type": "basic",
"lua": "local _M = {}\n\n--[[\n Entry point of Lua rule\n @config: config of socks5 application\n @rule: socks5 rule that includes this Lua code\n return: true, false, nil and error message\n]]\nfunction _M.run(config, rule)\n -- do something\n return true\nend\n\nreturn _M",
"src": [
"-"
],
"dst": [
"-"
],
"bandwidth": 30,
"src_type": "-",
"dst_type": "-",
"start_time": 1621832280,
"end_time": 1621832280,
"dst_port": null
}
'
响应示例
Status: 200 OK
{
"status": 0,
"data": {
"id": 1
}
}
修改授权规则
URI
PUT /admin-api/socks5_proxy/{id}/auth_rules/{id}
JSON Body 参数
enabled
type: boolean
required: no
description: 启用/禁用
type
type: string
required: yes
description: 动作类型,permit 或 deny
rule_type
type: string
required: yes
description: 规则类型,lua 或 basic
bandwidth
type: integer
required: yes
description: 带宽
start_time
type: integer
required: yes
description: 规则有效起始时间
end_time
type: integer
required: yes
description: 规则有效结束时间
dst_port
type: integer
required: no
description: 目标端口
src
type: string
required: yes
description: 源
dst
type: string
required: yes
description: 目标
请求示例
Shell
curl -X PUT http://{admin-site}/admin-api/socks5_proxy/{id}/auth_rules/{id} -d
'{
"data": [
{
"_modified_unix": 1621838858.0789,
"dst_type": "-",
"lua": "local _M = {}\n\n--[[\n Entry point of Lua rule\n @config: config of socks5 application\n @rule: socks5 rule that includes this Lua code\n return: true, false, nil and error message\n]]\nfunction _M.run(config, rule)\n -- do something\n return true\nend\n\nreturn _M",
"start_time": 1621832280,
"id": 2,
"rule_type": "basic",
"dst": [
"-"
],
"src_type": "-",
"bandwidth": 301,
"enabled": true,
"type": "permit",
"end_time": 1621832280,
"src": [
"-"
],
"_created_unix": 1621832319.6485,
"order": 0
}
],
"status": 0
}
'
响应示例
Status: 200 OK
{
"status": 0
}
删除授权规则
URI
DELETE /admin-api/socks5_proxy/{id}/auth_rules/{id}
请求示例
Shell
curl -X DELETE http://{admin-site}/admin-api/socks5_proxy/{id}/auth_rules/{id}
响应示例
Status: 200 OK
{
"status": 0
}