0

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

Flimzy
  • 68,325
  • 15
  • 126
  • 165
Sathish Ramani
  • 823
  • 4
  • 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