feat(watchdog): improve watchdog instance tracking

- Add Close() function to watchdog for graceful shutdown
- Update instance message format for better consistency
- Add watchdog status tracking in StatusInfo
- Include watchdog field in FrpcInstance struct and database
- Change port fields from string to int in FrpcProxyInfo
- Add auth_token support in InstanceInfo
This commit is contained in:
2026-04-05 22:44:53 +08:00
parent f006c2307a
commit 37c10f1c07
6 changed files with 75 additions and 31 deletions
+4 -2
View File
@@ -27,6 +27,7 @@ type InstanceInfo struct {
ServerAddr string `json:"serverAddr"`
ServerPort string `json:"serverPort"`
AuthMethod string `json:"auth_method"`
AuthToken string `json:"auth_token"`
RunUser string `json:"runUser"`
Additional map[string]interface{} `json:"additionalProperties"`
}
@@ -35,8 +36,8 @@ type FrpcProxyInfo struct {
Name string `json:"name"`
Type string `json:"type"`
LocalIP string `json:"local_ip"`
LocalPort string `json:"local_port"`
RemotePort string `json:"remote_port"`
LocalPort int `json:"local_port"`
RemotePort int `json:"remote_port"`
}
type CreateInstanceRequest struct {
@@ -238,6 +239,7 @@ func generateFrpcConfig(info InstanceInfo) string {
config.Global["serverAddr"] = info.ServerAddr
config.Global["serverPort"] = info.ServerPort
config.Global["auth.method"] = info.AuthMethod
config.Global["auth.token"] = info.AuthToken
for key, value := range info.Additional {
config.Global[key] = value