From c7ba55fc832c870a888b347e29a6195f4f38b27b Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 3 Sep 2020 09:53:14 -0700 Subject: [PATCH] use default port of 9009 if none found #236 --- src/croc/croc.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/croc/croc.go b/src/croc/croc.go index 4c5646a..bb8254f 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -352,13 +352,11 @@ func (c *Client) Send(options TransferOptions) (err error) { if address == "" { continue } - host, port, err := net.SplitHostPort(address) - if err != nil { - log.Errorf("bad relay address %s", address) - continue - } + host, port, _ := net.SplitHostPort(address) + log.Debugf("host: '%s', port: '%s'", host, port) // Default port to :9009 if port == "" { + host = address port = "9009" } log.Debugf("got host '%v' and port '%v'", host, port) @@ -520,13 +518,10 @@ func (c *Client) Receive() (err error) { continue } var host, port string - host, port, err = net.SplitHostPort(address) - if err != nil { - log.Errorf("bad relay address %s", address) - continue - } + host, port, _ = net.SplitHostPort(address) // Default port to :9009 if port == "" { + host = address port = "9009" } log.Debugf("got host '%v' and port '%v'", host, port)