优化代码

This commit is contained in:
GoEdgeLab
2022-03-22 21:45:07 +08:00
parent 2b0e2b6888
commit 1e4143bcbb
148 changed files with 340 additions and 315 deletions

View File

@@ -146,7 +146,7 @@ func (this *DNSTaskExecutor) doServer(taskId int64, serverId int64) error {
recordValue := clusterDNSName + "." + domain + "."
recordRoute := manager.DefaultRoute()
recordType := dnstypes.RecordTypeCNAME
if serverDNS.State == models.ServerStateDisabled || serverDNS.IsOn == 0 {
if serverDNS.State == models.ServerStateDisabled || !serverDNS.IsOn {
// 检查记录是否已经存在
record, err := manager.QueryRecord(domain, recordName, recordType)
if err != nil {
@@ -333,7 +333,7 @@ func (this *DNSTaskExecutor) doCluster(taskId int64, clusterId int64) error {
}
for _, ipAddress := range ipAddresses {
ip := ipAddress.DNSIP()
if len(ip) == 0 || ipAddress.CanAccess == 0 || ipAddress.IsUp == 0 || ipAddress.IsOn == 0 {
if len(ip) == 0 || ipAddress.CanAccess == 0 || ipAddress.IsUp == 0 || !ipAddress.IsOn {
continue
}
if net.ParseIP(ip) == nil {