MCPcopy
hub / github.com/jeessy2/ddns-go / Init

Method Init

dns/gcore.go:75–92  ·  view source on GitHub ↗

Init 初始化

(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache)

Source from the content-addressed store, hash-verified

73
74// Init 初始化
75func (gc *Gcore) Init(dnsConf *config.DnsConfig, ipv4cache *util.IpCache, ipv6cache *util.IpCache) {
76 gc.Domains.Ipv4Cache = ipv4cache
77 gc.Domains.Ipv6Cache = ipv6cache
78 gc.DNS = dnsConf.DNS
79 gc.Domains.GetNewIp(dnsConf)
80 if dnsConf.TTL == "" {
81 // 默认 120 秒(免费版最低值)
82 gc.TTL = 120
83 } else {
84 ttl, err := strconv.Atoi(dnsConf.TTL)
85 if err != nil {
86 gc.TTL = 120
87 } else {
88 gc.TTL = ttl
89 }
90 }
91 gc.httpClient = dnsConf.GetHTTPClient()
92}
93
94// AddUpdateDomainRecords 添加或更新 IPv4 / IPv6 记录
95func (gc *Gcore) AddUpdateDomainRecords() config.Domains {

Callers

nothing calls this directly

Calls 2

GetNewIpMethod · 0.80
GetHTTPClientMethod · 0.80

Tested by

no test coverage detected