日志打印时间
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -69,21 +70,21 @@ func FetchSubdomainRecord(key string, domain string, Subdomain string) string {
|
||||
// 获取 DNS 记录
|
||||
response, err := RetrieveDNSRecords(key, domain)
|
||||
if err != nil {
|
||||
fmt.Println("获取 DNS 记录失败:", err)
|
||||
log.Println("获取 DNS 记录失败:", err)
|
||||
return "NULL"
|
||||
}
|
||||
|
||||
// 打印完整 JSON 数据
|
||||
_, err = json.MarshalIndent(response, "", " ")
|
||||
if err != nil {
|
||||
fmt.Println("JSON 格式化失败:", err)
|
||||
log.Println("JSON 格式化失败:", err)
|
||||
return "NULL"
|
||||
}
|
||||
|
||||
// 只获取指定子域名的信息
|
||||
for _, record := range response.Reply.ResourceRecords {
|
||||
if record.Host == Subdomain {
|
||||
fmt.Printf("RecordID: %s, Host: %s, Type: %s, Value: %s, TTL: %s, Distance: %s\n",
|
||||
log.Printf("RecordID: %s, Host: %s, Type: %s, Value: %s, TTL: %s, Distance: %s\n",
|
||||
record.RecordID, record.Host, record.Type, record.Value, record.TTL, parseDistance(record.Distance))
|
||||
|
||||
return record.RecordID
|
||||
|
||||
Reference in New Issue
Block a user