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
+16 -2
View File
@@ -9,7 +9,7 @@ func AddInstance(serviceName string) bool {
return false
}
message := fmt.Sprintf("[addInstance] <serviceName>%s</serviceName>", serviceName)
message := fmt.Sprintf("[instance.add] <serviceName>%s</serviceName>", serviceName)
response, err := sendMsg(message, 3)
if err != nil {
return false
@@ -23,7 +23,7 @@ func RemoveInstance(serviceName string) bool {
return false
}
message := fmt.Sprintf("[removeInstance] <serviceName>%s</serviceName>", serviceName)
message := fmt.Sprintf("[instance.remove] <serviceName>%s</serviceName>", serviceName)
response, err := sendMsg(message, 3)
if err != nil {
return false
@@ -31,3 +31,17 @@ func RemoveInstance(serviceName string) bool {
return response == "success"
}
func Close() bool {
if !IsConnected() {
return false
}
message := "watchdog.shutdown"
response, err := sendMsg(message, 3)
if err != nil {
return false
}
return response == "success"
}