If we can't connect to internet, fail
This commit is contained in:
parent
a8926aaab6
commit
01d609e859
3
init.go
3
init.go
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user