use default port of 9009 if none found #236

This commit is contained in:
Zack Scholl 2020-09-03 09:53:14 -07:00
parent 85b370291d
commit c7ba55fc83
1 changed files with 5 additions and 10 deletions

View File

@ -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)