From 965fc367ac5416ebbc846ae2d3541b5fe4710a51 Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Mon, 26 Oct 2020 18:10:39 +0000 Subject: [PATCH] check for ULA and no IP --- init.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/init.go b/init.go index 328f783..d915ac5 100644 --- a/init.go +++ b/init.go @@ -35,6 +35,10 @@ func Init() { conf.IP = conf.MustAllocateIP() conf.IP6 = conf.MustAllocateIP6() + if len(conf.ExternalIP) == 0 && len(conf.ExternalIP6) == 0 { + ExitFail("Could not determine any external IP, v4 or v6") + } + // DNS not set by default //conf.DNS = IP @@ -116,7 +120,11 @@ func getExternalIP6() net.IP { localAddr := conn.LocalAddr().String() IP = net.ParseIP(strings.Split(localAddr, ":")[0]) - return IP + + // check is not a ULA + if IP[0] != 0xfd && IP[0] != 0xfc { + return IP + } } client := http.Client{