fix dns look up error

This commit is contained in:
xvzc 2022-03-11 13:23:15 +09:00
parent 439e79ad73
commit 8a15c05fdb

View File

@ -1,6 +1,7 @@
package doh package doh
import ( import (
"errors"
"sync" "sync"
"github.com/babolivier/go-doh-client" "github.com/babolivier/go-doh-client"
@ -19,6 +20,10 @@ func Lookup(domain string) (string, error) {
return "", err return "", err
} }
if len(a) < 1 {
return "", errors.New(" couldn't resolve the domain")
}
ip := a[0].IP4 ip := a[0].IP4
return ip, nil return ip, nil