From bdf9e4508211e547bd09196c20d971375cca39e9 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 27 Apr 2018 09:53:31 +0100 Subject: [PATCH] Default to previous scheme when url.Parse returns an error In response to: ``` panic: parse x.x.x.x:xxx: first path segment in URL cannot contain colon goroutine 33 [running]: yggdrasil.(*Core).DEBUG_addPeer(0x8e58000, 0x8e34080, 0x12) /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}/src/yggdrasil/debug.go:317 +0x420 main.(*node).init.func1(0x8e48000, 0x8e58000) /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}/yggdrasil.go:75 +0x70 created by main.(*node).init /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}/yggdrasil.go:69 +0x410 ``` --- src/yggdrasil/debug.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/yggdrasil/debug.go b/src/yggdrasil/debug.go index dcc2581f..faa7471e 100644 --- a/src/yggdrasil/debug.go +++ b/src/yggdrasil/debug.go @@ -313,10 +313,7 @@ func (c *Core) DEBUG_maybeSendUDPKeys(saddr string) { func (c *Core) DEBUG_addPeer(addr string) { u, err := url.Parse(addr) - if err != nil { - panic(err) - } - if len(u.Opaque) == 0 { + if err == nil { switch strings.ToLower(u.Scheme) { case "tcp": c.DEBUG_addTCPConn(u.Host)