feat(watchdog): add watchdog service with TCP client implementation
- Implement TCP client for watchdog service communication - Add watchdog configuration in config.json - Update main.go to initialize and connect to watchdog - Add watchdog related functions (connect, command handling) - Update README.md with new watchdog feature - Improve route setup logging in router.go
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os/signal"
|
||||
"super-frpc/frpLogger"
|
||||
"super-frpc/postLog"
|
||||
"super-frpc/watchdog"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
@@ -90,6 +91,17 @@ func main() {
|
||||
|
||||
setupRoutes()
|
||||
|
||||
err = watchdog.Init()
|
||||
if err != nil {
|
||||
postLog.Error(fmt.Sprintf("Unable to initialize Watchdog: %s", err))
|
||||
} else {
|
||||
if !watchdog.Connect("127.0.0.1", config.Watchdog.Port) {
|
||||
postLog.Error(fmt.Sprintf("Failed to connect to Watchdog at %s:%d", "127.0.0.1", config.Watchdog.Port))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
addr := fmt.Sprintf("%s:%s", config.ListenAddr, config.ListenPort)
|
||||
server := &http.Server{
|
||||
Addr: addr,
|
||||
|
||||
Reference in New Issue
Block a user