mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 14:26:31 +00:00
27 lines
473 B
Go
27 lines
473 B
Go
package util
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/babolivier/go-doh-client"
|
|
)
|
|
|
|
func DnsLookupOverHttps(dns string, domain string) (string, error) {
|
|
// Perform a A lookup on example.com
|
|
resolver := doh.Resolver{
|
|
Host: dns, // Change this with your favourite DoH-compliant resolver.
|
|
Class: doh.IN,
|
|
}
|
|
|
|
Debug(domain)
|
|
a, _, err := resolver.LookupA(domain)
|
|
if err != nil {
|
|
log.Println("Error looking up dns. ", err)
|
|
return "", err
|
|
}
|
|
|
|
ip := a[0].IP4
|
|
|
|
return ip, nil
|
|
}
|