1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

feat: add No-IP provider

This commit is contained in:
Timothy
2020-08-10 23:49:12 +08:00
parent 1ddd1dfb8b
commit a7c2b0a56e
12 changed files with 202 additions and 27 deletions

View File

@@ -83,18 +83,26 @@ func (r *DNSResolver) lookupHost(host string, dnsType uint16, triesLeft int) ([]
}
if dnsType == dns.TypeA {
for _, record := range in.Answer {
if t, ok := record.(*dns.A); ok {
result = append(result, t.A)
if len(in.Answer) > 0 {
for _, record := range in.Answer {
if t, ok := record.(*dns.A); ok {
result = append(result, t.A)
}
}
} else {
return result, errors.New("empty result")
}
}
if dnsType == dns.TypeAAAA {
for _, record := range in.Answer {
if t, ok := record.(*dns.AAAA); ok {
result = append(result, t.AAAA)
if len(in.Answer) > 0 {
for _, record := range in.Answer {
if t, ok := record.(*dns.AAAA); ok {
result = append(result, t.AAAA)
}
}
} else {
return result, errors.New("Cannot resolve this domain, please make sure the IP type is right")
}
}