Golang net.LookupTXT() function example
package net
Golang net.LookupTXT() function usage example
package main
import (
"fmt"
"net"
)
func main() {
dnstxt, err := net.LookupTXT("nytimes.com")
if err != nil {
fmt.Println(err)
return
}
for i := 0; i < len(dnstxt); i++ {
fmt.Printf("DNS TXT record #%d : %s \n", i, dnstxt[i])
}
}
Sample output :
DNS TXT record #0 : v=spf1 mx ptr ip4:170.149.160.0/19 include:alerts.wallst.com include:authsmtp.com include:sendgrid.net include:_spf.google.com include:inyt.com ~all
DNS TXT record #1 : adobe-idp-site-verification=5ce4d99c-af0a-4b76-9217-bd49d3336df0
DNS TXT record #2 : 253961548-4297453
DNS TXT record #3 : google-site-verification=ZsySMeZ_SRbJZFu-53ptepytP7h5pxHO0qAg8Z2bKug
Reference :
Advertisement
Something interesting
Tutorials
+10.7k Android Studio : Simple input textbox and intercept key example
+5.3k Golang : The Tao of importing package
+6.9k Mac/Linux/Windows : Get CPU information from command line
+8.9k Golang : Accept any number of function arguments with three dots(...)
+9.5k Golang : Generate EAN barcode
+8k Golang : Gomobile init produce "iphoneos" cannot be located error
+11.8k Golang : Secure file deletion with wipe example
+9.7k Golang : How to extract video or image files from html source code
+13.5k Golang : Get constant name from value
+23.6k Golang : Read a file into an array or slice example