forked from TrueCloudLab/neoneo-go
_pkg.dev: drop util/ip package
It's an unneccessary kludge, master gets its IP from config and that's it.
This commit is contained in:
parent
5938ebb85b
commit
d7701fe7db
1 changed files with 0 additions and 20 deletions
|
@ -1,20 +0,0 @@
|
||||||
package iputils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
)
|
|
||||||
|
|
||||||
//GetLocalIP returns the ip address of the current node
|
|
||||||
// https://stackoverflow.com/a/37382208
|
|
||||||
func GetLocalIP() net.IP {
|
|
||||||
conn, err := net.Dial("udp", "8.8.8.8:80")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
|
||||||
|
|
||||||
return localAddr.IP
|
|
||||||
}
|
|
Loading…
Reference in a new issue