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
+8.5k Golang : Format strings to SEO friendly URL example
+6.7k Golang : Ways to recover memory during run time.
+4.9k Golang : Find change in a combination of coins example
+5.1k AWS S3 : Prevent Hotlinking policy
+13.3k Golang : Parsing or breaking down URL
+5k Golang : Detect variable or constant type
+9k Android Studio : Simple input textbox and intercept key example
+12.1k Swift : Convert (cast) Int to String ?
+8.2k Golang : Scramble and unscramble text message by randomly replacing words
+5.3k Golang : Map within a map example
+16.5k Golang : Aligning strings to right, left and center with fill example
+18.3k Golang : Compare floating-point numbers