# SOCKS5

# 获取应用列表

# 简介

获取指定分页的 SOCKS5 应用列表

# URI

GET /admin-api/socks5_proxy?start=0&end=49&page=1&page_size=50

# URI 参数

  • page

    type: integer

    required: no

    description: 第几页,从 1 开始

  • page_size

    type: integer

    required: no

    description: 每页大小,默认 50

# 请求示例

# Shell

curl http://{admin-site}/admin-api/socks5_proxy?start=0&end=49&page=1&page_size=50

# 响应示例

Status: 200 OK
{
    "data": {
        "data": [
            {
                "connect_timeout": 3000,
                "read_timeout": 3000,
                "redis_port": 6379,
                "timeout_count": 50,
                "auth_type": "none",
                "redis_db": 0,
                "auth_cache": 3600,
                "redis_connect_timeout": 3000,
                "write_timeout": 3000,
                "redis_send_timeout": 3000,
                "pending_changes": 0,
                "redis_read_timeout": 3000,
                "_modified_unix": 1621830550.9843,
                "partitions": [
                    1
                ],
                "_created_unix": 1621830550.9843,
                "aes256_timeout": 86400000,
                "bind_password": "",
                "ports": [
                    8888
                ],
                "creator": 1,
                "enabled_order_info": false,
                "log_enable": true,
                "id": 3
            }
        ],
        "meta": {
            "count": 1
        }
    },
    "status": 0
}

# 获取指定 SOCKS5 应用配置

# 简介

获取指定 ID 的 SOCKS5 应用的配置。

# URI

GET /admin-api/socks5_proxy/{id}

# 请求示例

# Shell

curl http://{admin-site}/admin-api/socks5_proxy/3

# 响应示例

Status: 200 OK
{
    "data": {
        "connect_timeout": 3000,
        "permission": {
            "socks5.bandwidth": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.bandwidth",
                "write": true
            },
            "socks5.log": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.log",
                "write": true
            },
            "socks5.config": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.config",
                "write": true
            },
            "socks5.order": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.order",
                "write": true
            },
            "socks5.users": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.users",
                "write": true
            },
            "socks5.auth": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.auth",
                "write": true
            },
            "socks5.access": {
                "config_item": [
                    "read",
                    "write"
                ],
                "read": true,
                "path": "socks5.access",
                "write": true
            }
        },
        "read_timeout": 3000,
        "redis_port": 6379,
        "timeout_count": 50,
        "auth_type": "none",
        "redis_db": 0,
        "auth_cache": 3600,
        "redis_connect_timeout": 3000,
        "write_timeout": 3000,
        "redis_send_timeout": 3000,
        "pending_changes": 0,
        "redis_read_timeout": 3000,
        "_modified_unix": 1621830550.9843,
        "partitions": [
            1
        ],
        "_created_unix": 1621830550.9843,
        "aes256_timeout": 86400000,
        "bind_password": "",
        "ports": [
            8888
        ],
        "creator": 1,
        "enabled_order_info": false,
        "log_enable": true,
        "id": 3
    },
    "status": 0
}

# 创建 SOCKS5 应用

# 简介

创建 SOCKS5 应用。

# URI

POST /admin-api/socks5_proxy

# JSON Body 参数

  • ports

    type: array

    required: yes

    description: SOCKS5 服务端口

  • partitions

    type: array

    required: yes

    description: 应用所属分区

  • label

    type: string

    required: no

    description: 标签

# 请求示例

# Shell

curl -X POST http://{admin-site}/admin-api/socks5_proxy/ -d
'{
    "ports": [
        8888
    ],
    "partitions": [
        1
    ],
    "label": "label"
}'

# 响应示例

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

# 修改 SOCKS5 应用配置

# 简介

修改 SOCKS5 应用配置。

# URI

PUT /admin-api/socks5_proxy/{id}

# JSON Body 参数

  • ports

    type: array

    required: yes

    description: SOCKS5 服务端口

  • partitions

    type: array

    required: yes

    description: 应用所属分区

  • label

    type: string

    required: no

    description: 标签

  • connect_timeout

    type: integer

    required: no

    description: 连接超时时间

  • read_timeout

    type: integer

    required: no

    description: 读取超时时间

  • timeout_count

    type: integer

    required: no

    description: 超时次数

  • enableAuth

    type: boolean

    required: no

    description: 启用认证

  • auth_type

    type: string

    required: yes

    description: 认证类型, 多选时用空格分割;启用认证后方可配置

  • auth_cache

    type: integer

    required: no

    description: 认证缓存时间(秒)

  • log_enable

    type: boolean

    required: no

    description: 启用日志

  • log_format

    type: string

    required: no

    description: 日志格式,启用日志后方可配置

  • log_path

    type: string

    required: no

    description: 日志文件名称,启用日志后方可配置

  • lua

    type: string

    required: no

    description: lua 代码认证方式;启用认证后方可配置

# 请求示例

# Shell

curl -X PUT http://{admin-site}/admin-api/socks5_proxy/2
'{
    "connect_timeout": 3000,
    "read_timeout": 3000,
    "redis_port": 6379,
    "timeout_count": 50,
    "auth_type": "normal ldap lua aes-256 third-part",
    "redis_db": 0,
    "auth_cache": 3600,
    "redis_connect_timeout": 3000,
    "write_timeout": 3000,
    "redis_send_timeout": 3000,
    "pending_changes": 0,
    "redis_read_timeout": 3000,
    "_modified_unix": 1621830550.9843,
    "partitions": [
        1
    ],
    "_created_unix": 1621830550.9843,
    "aes256_timeout": 86400000,
    "ports": [
        8888
    ],
    "creator": 1,
    "enabled_order_info": true,
    "log_enable": true,
    "id": 3,
    "log_format": "$time proxy_port: $proxy_port, client_addr: $client_addr, user: $username, dst: $upstream_host, dst_port: $upstream_port, status: $status, bandwidth: $bandwidth, failure: $failure",
    "log_path": "socks5_access.log",
    "auto_sync": true,
    "lua": "local _M = {}\n\n--[[\n  Entry point of Lua rule\n  @config: config of socks5 application\n  return: true, false, nil and error message\n]]\nfunction _M.run(config)\n  -- do something\n  return true\nend\n\nreturn _M",
    "enableAuth": true,
    "authType": [
        "normal",
        "ldap",
        "lua",
        "aes-256",
        "third-part"
    ],
    "redis_write_timeout": 3000,
    "ldap_server": "192.168.50.84",
    "search_dn": "fdas",
    "search_standard": "fdas",
    "bind_dn": "fasd",
    "aes256_app_key": "test",
    "aes256_app_secret": "40A4510F290AD8182AF4B0260C655F8511E5B46BCA20EA191D8BC7B4D99CE95F",
    "third_part_url": "https://aaaa.acom",
    "third_part_token": "fdasf",
    "redis_host": "35.194.129.162",
    "bind_password": ""
}'

# 响应示例

Status: 200 OK
{
    "status": 0
}

# 删除 SOCKS5 应用

# 简介

删除 SOCKS5 应用。

# URI

DELETE /admin-api/socks5_proxy/{id}

# 请求示例

# Shell

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

# 响应示例

Status: 200 OK
{
    "status": 0
}