refactor(frpc): restructure instance management and config handling

- Move instance-related structs and functions to config.go
- Remove serverAddr, serverPort, and authMethod from database schema
- Implement new config parsing and encoding with nested key support
- Update service management to use instanceID instead of username/name
- Add GetServiceNameByInstanceID helper function
- Update API documentation for auth.method field change
This commit is contained in:
2026-03-25 20:00:34 +08:00
parent da729b44ff
commit 92a0e24db7
8 changed files with 491 additions and 281 deletions
+5 -5
View File
@@ -552,8 +552,8 @@ Modify fields in the `[common]` section of the frpc configuration file. Only `[c
"modifiedData": {
"server_addr": "192.168.1.1",
"server_port": "7000",
"auth_method": "token",
"auth_token": "my_secret_token"
"auth.method": "token",
"auth.token": "my_secret_token"
}
}
```
@@ -1149,7 +1149,7 @@ X-Timestamp: 1704067200000
"name": "my_frpc",
"serverAddr": "127.0.0.1",
"serverPort": "7000",
"auth_method": "token",
"auth.method": "token",
"bootAtStart": true,
"runUser": "root",
"configPath": "./configs/superfrpc_user_my_frpc.toml",
@@ -1185,14 +1185,14 @@ X-Timestamp: 1704067200000
| name | string | Instance name |
| serverAddr | string | frps server address (admin/superuser only) |
| serverPort | string | frps server port (admin/superuser only) |
| auth_method | string | Authentication method (admin/superuser only) |
| auth.method | string | Authentication method (admin/superuser only) |
| bootAtStart | bool | Auto-start on system boot |
| runUser | string | User to run the frpc instance as |
| configPath | string | Path to the configuration file |
| createdAt | string | Instance creation time (ISO 8601 format) |
| createdBy | string | Username of the user who created this instance |
> Note: Visitor users do not see sensitive information (serverAddr, serverPort, auth_method).
> Note: Visitor users do not see sensitive information (serverAddr, serverPort, auth.method).
---