forked from extern/smegmesh
19 lines
241 B
Go
19 lines
241 B
Go
package lib
|
|
|
|
import (
|
|
"log"
|
|
"net"
|
|
)
|
|
|
|
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
|
|
}
|