feat: ddns 模块 dnspod 类型实装
This commit is contained in:
@@ -15,9 +15,9 @@ type DnsProvider struct {
|
|||||||
Token string `mapstructure:"token"`
|
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{
|
var p = DnsProvider{
|
||||||
TTL: int(ttl),
|
TTL: ttl,
|
||||||
}
|
}
|
||||||
e := dnsUtil.DecodeConfig(conf, &p)
|
e := dnsUtil.DecodeConfig(conf, &p)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type DnsProvider struct {
|
|||||||
SecretKey string `mapstructure:"secret_key"`
|
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}
|
var p = DnsProvider{TTL: ttl}
|
||||||
e := dnsUtil.DecodeConfig(conf, &p)
|
e := dnsUtil.DecodeConfig(conf, &p)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Mmx233/BitSrunLoginGo/dns/aliyun"
|
"github.com/Mmx233/BitSrunLoginGo/dns/aliyun"
|
||||||
"github.com/Mmx233/BitSrunLoginGo/dns/cloudflare"
|
"github.com/Mmx233/BitSrunLoginGo/dns/cloudflare"
|
||||||
|
"github.com/Mmx233/BitSrunLoginGo/dns/dnspod"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -23,7 +24,9 @@ func Run(c *Config) error {
|
|||||||
case "aliyun":
|
case "aliyun":
|
||||||
dns, e = aliyun.New(c.TTL, c.Conf, c.Http)
|
dns, e = aliyun.New(c.TTL, c.Conf, c.Http)
|
||||||
case "cloudflare":
|
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:
|
default:
|
||||||
var msg string
|
var msg string
|
||||||
if c.Provider == "" {
|
if c.Provider == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user