mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
ping server from discoveries
This commit is contained in:
parent
034e012227
commit
d3aa2be9ab
1 changed files with 8 additions and 6 deletions
|
@ -542,14 +542,16 @@ func (c *Client) Receive() (err error) {
|
||||||
if portToUse == "" {
|
if portToUse == "" {
|
||||||
portToUse = "9009"
|
portToUse = "9009"
|
||||||
}
|
}
|
||||||
c.Options.RelayAddress = net.JoinHostPort(discoveries[0].Address, portToUse)
|
address := net.JoinHostPort(discoveries[0].Address, portToUse)
|
||||||
|
if tcp.PingServer(address) == nil {
|
||||||
|
c.Options.RelayAddress = address
|
||||||
c.ExternalIPConnected = c.Options.RelayAddress
|
c.ExternalIPConnected = c.Options.RelayAddress
|
||||||
c.Options.RelayAddress6 = ""
|
c.Options.RelayAddress6 = ""
|
||||||
usingLocal = true
|
usingLocal = true
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
log.Debugf("discoveries: %+v", discoveries)
|
log.Debugf("discoveries: %+v", discoveries)
|
||||||
log.Debug("establishing connection")
|
log.Debug("establishing connection")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue