summaryrefslogtreecommitdiff
path: root/dns-https.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-06 16:59:33 -0600
committerJeff Carr <[email protected]>2024-01-06 16:59:33 -0600
commit15d9f9769360b1cb8c748de8ee995030ade5eb35 (patch)
tree97f7c9057c284fbb8f9e0428533f2d7b4da85772 /dns-https.go
parent983517732d9f193771665d8191c58e47028c6670 (diff)
all engines running and stable
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'dns-https.go')
-rw-r--r--dns-https.go30
1 files changed, 29 insertions, 1 deletions
diff --git a/dns-https.go b/dns-https.go
index bd06d4c..d7a5469 100644
--- a/dns-https.go
+++ b/dns-https.go
@@ -2,10 +2,13 @@ package main
import (
"fmt"
- "go.wit.com/log"
+ "strings"
"io/ioutil"
"encoding/json"
"net/http"
+
+ "go.wit.com/log"
+ "github.com/miekg/dns"
)
// dnsLookupDoH performs a DNS lookup for AAAA records over HTTPS.
@@ -54,3 +57,28 @@ func lookupDoH(hostname string, rrType string) []string {
return values
}
+
+func digAAAA(hostname string) []string {
+ var blah, ipv6Addresses []string
+ // domain := hostname
+ recordType := dns.TypeAAAA // dns.TypeTXT
+
+ // Cloudflare's DNS server
+ blah, _ = dnsUdpLookup("1.1.1.1:53", hostname, recordType)
+ log.Println("digAAAA() has BLAH =", blah)
+
+ if (len(blah) == 0) {
+ log.Println("digAAAA() RUNNING dnsAAAAlookupDoH(domain)")
+ ipv6Addresses = lookupDoH(hostname, "AAAA")
+ log.Println("digAAAA() has ipv6Addresses =", strings.Join(ipv6Addresses, " "))
+ for _, addr := range ipv6Addresses {
+ log.Println(addr)
+ }
+ return ipv6Addresses
+ }
+
+ // TODO: check digDoH vs blah, if so, then port 53 TCP and/or UDP is broken or blocked
+ log.Println("digAAAA() has BLAH =", blah)
+
+ return blah
+}