Golang ProgramsGolang Programs

Go program to find PTR pointer record of a domain

These records provide the reverse binding from addresses to names. PTR records should exactly match the forward maps. The net.LookupAddr() function performs a reverse finding for the address and returns a list of names that map to the given address.
package main
 
import (
	"fmt"
	"net"
)
 
func main() {
	ptr, _ := net.LookupAddr("6.8.8.8")
	for _, ptrvalue := range ptr {
		fmt.Println(ptrvalue)
	}
}

For the given address the above program returns a single reverse record as shown below:

C:\golang\dns>go run example3.go
tms_server.yuma.army.mil.