0

Is there an easy API in Go to figure out whether a given IP address / hostname belongs to the local machine?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Sathish Ramani
  • 893
  • 6
  • 10
  • You will have to [enumerate all network interfaces](https://golang.org/pkg/net/#Interfaces) and their addresses and compare them to the address in question. [os.Hostname](https://golang.org/pkg/os/#Hostname) returns the hostname. – Peter Jul 05 '20 at 10:54
  • maybe this answer help https://stackoverflow.com/a/50825191/2126159 – Diako Amir Jul 05 '20 at 11:49

0 Answers0