This commit is contained in:
parent
1bcad97ed2
commit
cbe1188e51
@ -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())
|
||||
|
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user