🎨恢复日志,优化监听

This commit is contained in:
2024-06-14 17:23:38 +08:00
parent 1bcad97ed2
commit cbe1188e51
2 changed files with 13 additions and 13 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())