-
-
Save dylanlott/a2c3d42023ca66725b437c9e852aed9a to your computer and use it in GitHub Desktop.
Golang DNS lookup (ip, mx, txt, etc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net" | |
) | |
func main() { | |
ips, err := net.LookupIP("google.com") | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println(ips) | |
mx, err := net.LookupMX("google.com") | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println(mx) | |
txt, err := net.LookupTXT("google.com") | |
if err != nil { | |
panic(err) | |
} | |
fmt.Println(txt) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment