0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 21:30:16 +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,11 +728,16 @@ 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 c.Options.RelayAddress == "localhost" {
host = c.Options.RelayAddress
} else {
host, _, err = net.SplitHostPort(c.Options.RelayAddress)
if err != nil { if err != nil {
log.Errorf("bad relay address %s", c.Options.RelayAddress) log.Errorf("bad relay address %s", c.Options.RelayAddress)
return 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)
c.conn[j+1], _, _, err = tcp.ConnectToTCPServer( c.conn[j+1], _, _, err = tcp.ConnectToTCPServer(