1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-28 09:35:14 +03:00

ping server from discoveries

This commit is contained in:
Zack Scholl 2020-10-22 10:11:11 -07:00
parent 034e012227
commit d3aa2be9ab

View File

@ -542,12 +542,14 @@ func (c *Client) Receive() (err error) {
if portToUse == "" {
portToUse = "9009"
}
c.Options.RelayAddress = net.JoinHostPort(discoveries[0].Address, portToUse)
c.ExternalIPConnected = c.Options.RelayAddress
c.Options.RelayAddress6 = ""
usingLocal = true
break
address := net.JoinHostPort(discoveries[0].Address, portToUse)
if tcp.PingServer(address) == nil {
c.Options.RelayAddress = address
c.ExternalIPConnected = c.Options.RelayAddress
c.Options.RelayAddress6 = ""
usingLocal = true
break
}
}
}
log.Debugf("discoveries: %+v", discoveries)