feat: 支持设置 cloudflare dns

This commit is contained in:
Mmx233
2022-12-08 19:06:14 +08:00
parent a5856fc63a
commit 84136031f7
3 changed files with 48 additions and 9 deletions

View File

@@ -9,7 +9,6 @@ import (
"fmt"
dnsUtil "github.com/Mmx233/BitSrunLoginGo/dns/util"
"github.com/Mmx233/tool"
log "github.com/sirupsen/logrus"
"math/rand"
"net/http"
"net/url"
@@ -29,8 +28,16 @@ func New(ttl uint, conf map[string]interface{}, Http *http.Client) (*DnsProvider
TTL: ttl,
Http: tool.NewHttpTool(Http),
}
defer log.Debugln("aliun dns provider:", &p)
return &p, dnsUtil.DecodeConfig(conf, &p)
e := dnsUtil.DecodeConfig(conf, &p)
if e != nil {
return nil, e
}
if p.AccessKeyId == "" || p.AccessKeySecret == "" {
return nil, errors.New("aliyun AccessKey 不能为空")
}
return &p, nil
}
func (a DnsProvider) SendRequest(Type, Action string, data map[string]interface{}) (*http.Response, error) {