Go program to find TXT records of a domain


This text record stores information about the SPF that can identify the authorized server to send email on behalf of your organization. The net.LookupTXT() function takes a domain name(facebook.com) as a string and returns a list of DNS TXT records as a slice of strings.

Example

package main
 
import (
	"fmt"
	"net"
)
 
func main() {
	txtrecords, _ := net.LookupTXT("facebook.com")
 
	for _, txt := range txtrecords {
		fmt.Println(txt)
	}
}

The single TXT record for gmail.com is shown below:

v=spf1 redirect=_spf.facebook.com
Most Helpful This Week