英文:
how to find the host name on the network given the ip address using go programming language
问题
使用Go编程语言,我可以根据主机名找到IP地址,但我想要的是根据IP地址找到主机名。我尝试研究了"net"包,但没有成功。
在Go语言中是否有可能实现这个功能?请给予建议。
英文:
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.
答案1
得分: 2
LookupAddr应该可以满足你的需求:
LookupAddr函数用于执行给定地址的反向查找,返回与该地址映射的名称列表。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论