Compare commits

...

3 Commits

Author SHA1 Message Date
d7680317c3 🎨暂时屏蔽监听队列 2024-06-17 10:20:46 +08:00
0964384b52 🎨停止定时任务 2024-06-14 19:51:46 +08:00
cbe1188e51 🎨恢复日志,优化监听 2024-06-14 17:23:38 +08:00
3 changed files with 14 additions and 15 deletions

View File

@@ -23,16 +23,6 @@ func offlineMonitoring() {
// 遍历客户端数据,并渲染数据信息
for _, d := range devices {
for _, p := range d.Peers {
clientInfo, err := repository.Client().GetByPublicKey(p.PublicKey.String())
if err != nil {
continue
}
// 没有启用离线监听时,即使客户端已经离线则也不执行
if clientInfo.OfflineMonitoring == nil || *clientInfo.OfflineMonitoring != 1 || clientInfo.Email == "" {
continue
}
var ipAllocation string
for _, iaip := range p.AllowedIPs {
ipAllocation += iaip.String() + ","
@@ -45,6 +35,16 @@ func offlineMonitoring() {
continue
}
clientInfo, err := repository.Client().GetByPublicKey(p.PublicKey.String())
if err != nil {
continue
}
// 没有启用离线监听时,即使客户端已经离线则也不执行
if clientInfo.OfflineMonitoring == nil || *clientInfo.OfflineMonitoring != 1 || clientInfo.Email == "" {
continue
}
content := fmt.Sprintf("客户端:%s\r\n", clientInfo.Name)
content += fmt.Sprintf("客户端IP%s\r\n", ipAllocation)
content += fmt.Sprintf("端点IP%s\r\n", p.Endpoint.String())

View File

@@ -72,9 +72,9 @@ func initDatabase() {
}
logLevel := gl.Info
if os.Getenv("GIN_MODE") == "release" {
logLevel = gl.Error
}
//if os.Getenv("GIN_MODE") == "release" {
// logLevel = gl.Error
//}
db, err := gorm.Open(dbDialector, &gorm.Config{
Logger: logger.NewGormLoggerWithConfig(gl.Config{

View File

@@ -9,7 +9,6 @@ import (
"wireguard-dashboard/config"
"wireguard-dashboard/cron_task"
"wireguard-dashboard/initialize"
"wireguard-dashboard/queues"
"wireguard-dashboard/route"
"wireguard-dashboard/script"
)
@@ -19,7 +18,7 @@ func init() {
if err := script.NewScript().Do(); err != nil {
log.Errorf("执行脚本失败: %v", err.Error())
}
go queues.StartConsumer() // 启动队列
//go queues.StartConsumer() // 启动队列
go cron_task.StartCronTask() // 启动定时任务
}