feat(proxy): add endpoint to list proxy configurations
Implement new GET endpoint `/frpcAct/proxyMgr/list` to retrieve proxy configurations from frpc instance config files. Includes handler function, API documentation, and route setup. The endpoint validates user permissions, reads and parses the config file, and returns structured proxy data with instance information.
This commit is contained in:
+82
@@ -784,6 +784,88 @@ X-Timestamp: 1704067200000
|
||||
|
||||
---
|
||||
|
||||
## List Proxies
|
||||
|
||||
**Endpoint:** `/frpcAct/proxyMgr/list`
|
||||
**Method:** GET
|
||||
**Auth Required:** Yes (token)
|
||||
**Permission Level:** None (any permission level)
|
||||
|
||||
Retrieve a list of all proxy configurations for a specific frpc instance. The proxy configurations are read from the instance's config file.
|
||||
|
||||
**Request Headers:**
|
||||
```
|
||||
X-Token: your_token
|
||||
X-Timestamp: 1704067200000
|
||||
```
|
||||
|
||||
**Query Parameters:**
|
||||
```
|
||||
?instanceID=1
|
||||
```
|
||||
|
||||
| Header | Type | Required | Description |
|
||||
|--------|------|----------|-------------|
|
||||
| X-Token | string | Yes | Authentication token |
|
||||
| X-Timestamp | int64 | Yes | Client timestamp in milliseconds |
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| instanceID | string | Yes | Instance ID (the ID of the frpc instance) |
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Proxies listed successfully",
|
||||
"data": {
|
||||
"instanceID": 1,
|
||||
"instanceName": "my_frpc",
|
||||
"proxyCount": 2,
|
||||
"proxies": [
|
||||
{
|
||||
"name": "ssh_proxy",
|
||||
"type": "tcp",
|
||||
"local_ip": "127.0.0.1",
|
||||
"local_port": "22",
|
||||
"remote_port": "6000"
|
||||
},
|
||||
{
|
||||
"name": "web_proxy",
|
||||
"type": "http",
|
||||
"local_ip": "127.0.0.1",
|
||||
"local_port": "8080",
|
||||
"remote_port": "80"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| instanceID | int | Instance ID |
|
||||
| instanceName | string | Name of the frpc instance |
|
||||
| proxyCount | int | Number of proxies |
|
||||
| proxies | array | List of proxy configurations |
|
||||
|
||||
**Proxy Object:**
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| name | string | Proxy name |
|
||||
| type | string | Proxy type (e.g., tcp, udp, http, https) |
|
||||
| local_ip | string | Local IP address to forward to |
|
||||
| local_port | string | Local port to forward from |
|
||||
| remote_port | string | Remote port on frps to expose |
|
||||
|
||||
> **Note:**
|
||||
> - The proxy configurations are read from the existing config file
|
||||
> - This endpoint does not modify the database, only reads the config file
|
||||
> - The returned proxy list represents the current configuration in the file
|
||||
> - Changes to the config file will be reflected in subsequent requests
|
||||
|
||||
---
|
||||
|
||||
## List frpc Instances
|
||||
|
||||
**Endpoint:** `/frpcAct/instanceMgr/list`
|
||||
|
||||
Reference in New Issue
Block a user