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
+7.5k Golang : Shuffle strings array
+6.9k Fix sudo yum hang problem with no output or error messages
+32.5k Golang : Copy directory - including sub-directories and files
+23.5k Golang : Check if element exist in map
+21.2k Golang : Clean up null characters from input data
+13.9k Golang : Get dimension(width and height) of image file
+14.4k Golang : Find network of an IP address
+6.8k Get Facebook friends working in same company
+8.9k Golang : Find network service name from given port and protocol
+21.6k Golang : Encrypt and decrypt data with TripleDES
+14.4k Android Studio : Use image as AlertDialog title with custom layout example