Skip to content

Commit

Permalink
default to port 9009 if port is lost during discovery
Browse files Browse the repository at this point in the history
fixes #222
  • Loading branch information
schollz committed Jul 15, 2020
1 parent 1255a79 commit 7fd8fda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/croc/croc.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,13 @@ func (c *Client) Receive() (err error) {
continue
}
log.Debug("switching to local")
portToUse := string(bytes.TrimPrefix(discoveries[0].Payload, []byte("croc")))
if portToUse == "" {
portToUse = "9009"
}
c.Options.RelayAddress = fmt.Sprintf("%s:%s",
discoveries[0].Address,
bytes.TrimPrefix(discoveries[0].Payload, []byte("croc")),
portToUse,
)
c.ExternalIPConnected = c.Options.RelayAddress
usingLocal = true
Expand Down

0 comments on commit 7fd8fda

Please sign in to comment.