mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2024-12-13 01:50:53 +01:00
18 lines
292 B
Go
18 lines
292 B
Go
package lib
|
|
|
|
import (
|
|
"log"
|
|
"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
|
|
}
|