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:
parent
baddb93c4e
commit
588e650d80
1 changed files with 9 additions and 4 deletions
|
@ -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(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue