Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package reporterconfigs
// GlobalSetting 全局设置
type GlobalSetting struct {
MinNotifyConnectivity float64 `json:"minNotifyConnectivity"` // 需要通知的最小连通值
NotifyWebHookURL string `json:"notifyWebHookURL"` // WebHook通知地址
}
func DefaultGlobalSetting() *GlobalSetting {
return &GlobalSetting{
MinNotifyConnectivity: 100,
}
}

View File

@@ -0,0 +1,23 @@
package reporterconfigs
type MessageCode = string
// 节点相关消息
const (
MessageCodeConnectedAPINode MessageCode = "connectedAPINode" // 节点连接API节点成功
MessageCodeCheckSystemdService MessageCode = "checkSystemdService" // 检查Systemd服务
MessageCodeNewNodeTask MessageCode = "newNodeTask" // 有新的节点任务产生
)
// ConnectedAPINodeMessage 连接API节点成功
type ConnectedAPINodeMessage struct {
APINodeId int64 `json:"apiNodeId"`
}
// CheckSystemdServiceMessage Systemd服务
type CheckSystemdServiceMessage struct {
}
// NewNodeTaskMessage 有新的节点任务
type NewNodeTaskMessage struct {
}

View File

@@ -0,0 +1,11 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package reporterconfigs
type NodeConfig struct {
Id int64 `json:"id"`
}
func (this *NodeConfig) Init() error {
return nil
}

View File

@@ -0,0 +1,46 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package reporterconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
)
type ReportLevel = string
const (
ReportLevelGood ReportLevel = "good"
ReportLevelNormal ReportLevel = "normal"
ReportLevelBad ReportLevel = "bad"
ReportLevelBroken ReportLevel = "broken"
)
func FindAllReportLevels() []*shared.Definition {
return []*shared.Definition{
{
Name: "良好",
Code: ReportLevelGood,
},
{
Name: "正常",
Code: ReportLevelNormal,
},
{
Name: "不良",
Code: ReportLevelBad,
},
{
Name: "错误",
Code: ReportLevelBroken,
},
}
}
func FindReportLevelName(level ReportLevel) string {
for _, def := range FindAllReportLevels() {
if def.Code == level {
return def.Name
}
}
return ""
}

View File

@@ -0,0 +1,16 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package reporterconfigs
type Status struct {
IP string `json:"ip"`
OS string `json:"os"`
OSName string `json:"osName"`
Username string `json:"username"`
BuildVersion string `json:"buildVersion"` // 编译版本
BuildVersionCode uint32 `json:"buildVersionCode"` // 版本数字
UpdatedAt int64 `json:"updatedAt"` // 更新时间
Location string `json:"location"` // 从IP查询到的Location
ISP string `json:"isp"` // 从IP查询到的ISP
}

View File

@@ -0,0 +1,23 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package reporterconfigs
type TaskType = string
const (
TaskTypeIPAddr TaskType = "ipAddr"
)
type IPTask struct {
AddrId int64 `json:"addrId"`
IP string `json:"ip"`
Port int `json:"port"`
}
func FindTaskTypeName(taskType TaskType) string {
switch taskType {
case TaskTypeIPAddr:
return "IP地址"
}
return ""
}