Skip to content

Commit

Permalink
use default port of 9009 if none found #236
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Sep 3, 2020
1 parent 85b3702 commit c7ba55f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/croc/croc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c7ba55f

Please sign in to comment.