pkg: hide it by moving to _pkg.dev
The idea here is to preserve the history of `dev` branch development and its code when merging with the `master`. Later this code could be moved into the masters code where appropriate.
This commit is contained in:
parent
bb2568cc53
commit
ddd1d92ff1
183 changed files with 0 additions and 0 deletions
20
_pkg.dev/wire/util/ip/ip.go
Normal file
20
_pkg.dev/wire/util/ip/ip.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
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…
Add table
Add a link
Reference in a new issue