how to find the host name on the network given the ip address using go programming language

huangapple go评论91阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2015年8月11日 06:26:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/31930196.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定