From 48ffd9174118a297d49c8c6a0cda09e2f861dd90 Mon Sep 17 00:00:00 2001 From: Mmx233 Date: Mon, 2 Jan 2023 03:16:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ddns=20=E6=A8=A1=E5=9D=97=20dnspod=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AE=9E=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dns/cloudflare/cloudflare.go | 4 ++-- dns/dnspod/dnspod.go | 2 +- dns/initer.go | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dns/cloudflare/cloudflare.go b/dns/cloudflare/cloudflare.go index b151bdb..7f1be68 100644 --- a/dns/cloudflare/cloudflare.go +++ b/dns/cloudflare/cloudflare.go @@ -15,9 +15,9 @@ type DnsProvider struct { Token string `mapstructure:"token"` } -func New(ttl uint, conf map[string]interface{}, Http *http.Client) (*DnsProvider, error) { +func New(ttl int, conf map[string]interface{}, Http *http.Client) (*DnsProvider, error) { var p = DnsProvider{ - TTL: int(ttl), + TTL: ttl, } e := dnsUtil.DecodeConfig(conf, &p) if e != nil { diff --git a/dns/dnspod/dnspod.go b/dns/dnspod/dnspod.go index 3bb1885..c6ae9ec 100644 --- a/dns/dnspod/dnspod.go +++ b/dns/dnspod/dnspod.go @@ -17,7 +17,7 @@ type DnsProvider struct { SecretKey string `mapstructure:"secret_key"` } -func New(ttl uint64, conf map[string]interface{}, Http *http.Transport) (*DnsProvider, error) { +func New(ttl uint64, conf map[string]interface{}, Http http.RoundTripper) (*DnsProvider, error) { var p = DnsProvider{TTL: ttl} e := dnsUtil.DecodeConfig(conf, &p) if e != nil { diff --git a/dns/initer.go b/dns/initer.go index 3c64a2c..2dfb46f 100644 --- a/dns/initer.go +++ b/dns/initer.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/Mmx233/BitSrunLoginGo/dns/aliyun" "github.com/Mmx233/BitSrunLoginGo/dns/cloudflare" + "github.com/Mmx233/BitSrunLoginGo/dns/dnspod" log "github.com/sirupsen/logrus" ) @@ -23,7 +24,9 @@ func Run(c *Config) error { case "aliyun": dns, e = aliyun.New(c.TTL, c.Conf, c.Http) case "cloudflare": - dns, e = cloudflare.New(c.TTL, c.Conf, c.Http) + dns, e = cloudflare.New(int(c.TTL), c.Conf, c.Http) + case "dnspod": + dns, e = dnspod.New(uint64(c.TTL), c.Conf, c.Http.Transport) default: var msg string if c.Provider == "" {