If we can't connect to internet, fail

This commit is contained in:
Martin Eskdale Moen 2020-09-07 20:21:57 +01:00
parent a8926aaab6
commit 01d609e859

View File

@ -56,7 +56,8 @@ func getRandomNetwork() JSONIPNet {
// TODO support IPv6 // TODO support IPv6
func getExternalIP() net.IP { func getExternalIP() net.IP {
conn, _ := net.Dial("udp", "8.8.8.8:80") conn, err := net.Dial("udp", "8.8.8.8:80")
check(err, "Could not detect internet connection")
defer conn.Close() defer conn.Close()
localAddr := conn.LocalAddr().String() localAddr := conn.LocalAddr().String()