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 應用配置

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 應用

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 應用配置

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://third.com",
    "third_part_token": "fdasf",
    "redis_host": "35.194.129.162",
    "bind_password": ""
}'

響應示例

Status: 200 OK
{
    "status": 0
}

刪除 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
}