0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

don't split host if localhost

This commit is contained in:
Zack Scholl 2020-08-26 17:46:35 -07:00
parent baddb93c4e
commit 588e650d80

View file

@ -728,10 +728,15 @@ func (c *Client) procesMessagePake(m message.Message) (err error) {
log.Debugf("port: [%s]", c.Options.RelayPorts[i]) log.Debugf("port: [%s]", c.Options.RelayPorts[i])
go func(j int) { go func(j int) {
defer wg.Done() defer wg.Done()
host, _, err := net.SplitHostPort(c.Options.RelayAddress) var host string
if err != nil { if c.Options.RelayAddress == "localhost" {
log.Errorf("bad relay address %s", c.Options.RelayAddress) host = c.Options.RelayAddress
return } else {
host, _, err = net.SplitHostPort(c.Options.RelayAddress)
if err != nil {
log.Errorf("bad relay address %s", c.Options.RelayAddress)
return
}
} }
server := net.JoinHostPort(host, c.Options.RelayPorts[j]) server := net.JoinHostPort(host, c.Options.RelayPorts[j])
log.Debugf("connecting to %s", server) log.Debugf("connecting to %s", server)