如何使用go编程语言在给定ip地址的情况下在网络上查找主机名
问题描述:
Using go programming language, I'm able to find the IP address given the host name, but what I'm looking for is to find the host name given the ip address. I tried researching the "net" package, but no luck.
Is this something possible in golang? please advice.
使用Go编程语言,我能够找到给定主机名的IP地址,但是 寻找的是查找给定IP地址的主机名。 我尝试研究“ net”程序包,但是没有运气。 p>
在golang中这可能吗? 请咨询。 p> div>
答
LookupAddr should do what you are looking for:
LookupAddr performs a reverse lookup for the given address, returning a list of names mapping to that address.