集群增加自动同步时钟选项

This commit is contained in:
刘祥超
2022-09-15 15:56:50 +08:00
parent c8057457cc
commit 320d381bd9
5 changed files with 79 additions and 35 deletions

View File

@@ -2,7 +2,9 @@ package models
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
"github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs"
)
@@ -50,3 +52,15 @@ func (this *NodeCluster) HasDDoSProtection() bool {
}
return false
}
// DecodeClock 解析时钟配置
func (this *NodeCluster) DecodeClock() *nodeconfigs.ClockConfig {
var clock = nodeconfigs.DefaultClockConfig()
if IsNotNull(this.Clock) {
err := json.Unmarshal(this.Clock, clock)
if err != nil {
remotelogs.Error("NodeCluster.DecodeClock()", err.Error())
}
}
return clock
}