September 2017
Intermediate to advanced
466 pages
9h 33m
English
This subsection will present an additional kind of DNS lookup that returns the domain name servers for a given domain. This is very handy for troubleshooting DNS-related problems and finding out the status of a domain. The presented program will be named lookNS.go and will be presented in three parts.
The first part of the utility is the following:
package main import ( "fmt" "net" "os" )
The second part has the following Go code:
func main() {
arguments := os.Args
if len(arguments) == 1 {
fmt.Println("Please provide a domain!")
os.Exit(100)
}
domain := arguments[1]
NSs, err := net.LookupNS(domain)
The net.LookupNS() function does all the work for us by returning a slice of NS elements.
The last part of the ...
Read now
Unlock full access