Init 初始化
(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)
| 53 | |
| 54 | // Init 初始化 |
| 55 | func (hw *Huaweicloud) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache) { |
| 56 | hw.Domains.Ipv4Cache = ipv4cache |
| 57 | hw.Domains.Ipv6Cache = ipv6cache |
| 58 | hw.DNS = dnsConf.DNS |
| 59 | hw.Domains.GetNewIp(dnsConf) |
| 60 | if dnsConf.TTL == "" { |
| 61 | // 默认300s |
| 62 | hw.TTL = 300 |
| 63 | } else { |
| 64 | ttl, err := strconv.Atoi(dnsConf.TTL) |
| 65 | if err != nil { |
| 66 | hw.TTL = 300 |
| 67 | } else { |
| 68 | hw.TTL = ttl |
| 69 | } |
| 70 | } |
| 71 | hw.httpClient = dnsConf.GetHTTPClient() |
| 72 | } |
| 73 | |
| 74 | // AddUpdateDomainRecords 添加或更新IPv4/IPv6记录 |
| 75 | func (hw *Huaweicloud) AddUpdateDomainRecords() config.Domains { |
nothing calls this directly
no test coverage detected