mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-11 04:50:25 +08:00
智能DNS支持应答模式配置
This commit is contained in:
@@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs"
|
||||
)
|
||||
|
||||
@@ -43,3 +44,19 @@ func (this *NSCluster) DecodeHosts() []string {
|
||||
|
||||
return hosts
|
||||
}
|
||||
|
||||
// DecodeAnswerConfig 解析应答设置
|
||||
func (this *NSCluster) DecodeAnswerConfig() *dnsconfigs.NSAnswerConfig {
|
||||
var config = dnsconfigs.DefaultNSAnswerConfig()
|
||||
|
||||
if IsNull(this.Answer) {
|
||||
return config
|
||||
}
|
||||
|
||||
err := json.Unmarshal(this.Answer, config)
|
||||
if err != nil {
|
||||
remotelogs.Error("NSCluster.DecodeAnswerConfig", "decode failed: "+err.Error())
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user