51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"Watchdog_Linux-systemd/postLog"
|
|
"Watchdog_Linux-systemd/socket"
|
|
"fmt"
|
|
)
|
|
|
|
const (
|
|
listenAddr = "127.0.0.1"
|
|
listenPort = 10080
|
|
Type = "tcp"
|
|
)
|
|
|
|
type SoftwareInfo struct {
|
|
Name string
|
|
Version string
|
|
Developer string
|
|
BuildVer int16
|
|
Description string
|
|
BuildType string
|
|
}
|
|
|
|
var softwareInfo SoftwareInfo = SoftwareInfo{
|
|
Name: "Watchdog_Linux-systemd",
|
|
Version: "0.0.1",
|
|
Developer: "Super-frpc",
|
|
BuildVer: 1,
|
|
Description: "Super-frpc Watchdog service for Linux systemd",
|
|
BuildType: "Debug",
|
|
}
|
|
|
|
var isDebug bool
|
|
|
|
func main() {
|
|
loadConfig()
|
|
if isDebug == true {
|
|
postLog.SetDebugMode(true)
|
|
}
|
|
postLog.Info(fmt.Sprintf("%s %s (Build %d.%s) by %s", softwareInfo.Name, softwareInfo.Version, softwareInfo.BuildVer, softwareInfo.BuildType, softwareInfo.Developer))
|
|
|
|
go func() {
|
|
err := socket.BootSocket(Type, listenAddr, listenPort)
|
|
if err != nil {
|
|
postLog.Fatal(fmt.Sprintf("Failed to initialize socket server: %v", err))
|
|
}
|
|
}()
|
|
|
|
select {}
|
|
}
|