dns - Get domain name from IP address in Go -


i'm trying resolve host name ip address, apparently proving little more challenging thought it'd be.

i've tried using couple of functions, including net.lookuphost method, of them seem returning ip address input.

here's code using:

package main  import (     "fmt"     "net" )  func main() {     // obtained ping -c 1 stackoverflow.com, should print "stackoverflow.com"     addr, err := net.lookuphost("198.252.206.16")     fmt.println(addr, err) } 

for example,

package main  import (     "fmt"     "net" )  func main() {     // obtained ping -c 1 stackoverflow.com, should print "stackoverflow.com"     addr, err := net.lookupaddr("198.252.206.16")     fmt.println(addr, err) } 

output:

[stackoverflow.com.] <nil> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -