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
+11.8k Golang : Concurrency and goroutine example
+7.9k Golang : Regular Expression find string example
+10.3k Golang : How to get quoted string into another string?
+15.4k Golang : Delete certain files in a directory
+6.2k Golang : How to write backslash in string?
+11.2k How to test Facebook App on localhost ?
+36.6k Golang : How to split or chunking a file to smaller pieces?
+6.9k Golang : Experimental emojis or emoticons icons programming language
+19.4k Golang : Check if directory exist and create if does not exist
+12.5k Golang : Search and extract certain XML data example
+11.4k Golang : Intercept and process UNIX signals example
+23.7k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date