mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-17 08:31:04 +02:00
Interfacing out components for unit testing
This commit is contained in:
@ -5,14 +5,13 @@ import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// GetOutboundIP: gets the oubound IP of this packet
|
||||
func GetOutboundIP() 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
|
||||
}
|
||||
|
Reference in New Issue
Block a user