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:
parent
034e012227
commit
d3aa2be9ab
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user