mirror of https://github.com/schollz/croc.git
Support default port on receiver side
This commit is contained in:
parent
eb85477086
commit
1a544e4624
|
@ -331,12 +331,12 @@ func (c *Client) Send(options TransferOptions) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Debugf("establishing connection to %s", c.Options.RelayAddress)
|
|
||||||
var banner string
|
|
||||||
if !strings.Contains(c.Options.RelayAddress, ":") {
|
if !strings.Contains(c.Options.RelayAddress, ":") {
|
||||||
// try the default port, 9009
|
// try the default port, 9009
|
||||||
c.Options.RelayAddress += ":9009"
|
c.Options.RelayAddress += ":9009"
|
||||||
}
|
}
|
||||||
|
log.Debugf("establishing connection to %s", c.Options.RelayAddress)
|
||||||
|
var banner string
|
||||||
conn, banner, ipaddr, err := tcp.ConnectToTCPServer(c.Options.RelayAddress, c.Options.RelayPassword, c.Options.SharedSecret, 5*time.Second)
|
conn, banner, ipaddr, err := tcp.ConnectToTCPServer(c.Options.RelayAddress, c.Options.RelayPassword, c.Options.SharedSecret, 5*time.Second)
|
||||||
log.Debugf("banner: %s", banner)
|
log.Debugf("banner: %s", banner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -435,11 +435,17 @@ func (c *Client) Receive() (err error) {
|
||||||
)
|
)
|
||||||
c.ExternalIPConnected = c.Options.RelayAddress
|
c.ExternalIPConnected = c.Options.RelayAddress
|
||||||
usingLocal = true
|
usingLocal = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Debugf("discoveries: %+v", discoveries)
|
log.Debugf("discoveries: %+v", discoveries)
|
||||||
log.Debug("establishing connection")
|
log.Debug("establishing connection")
|
||||||
}
|
}
|
||||||
|
if !strings.Contains(c.Options.RelayAddress, ":") {
|
||||||
|
// try the default port, 9009
|
||||||
|
c.Options.RelayAddress += ":9009"
|
||||||
|
}
|
||||||
|
log.Debugf("establishing receiver connection to %s", c.Options.RelayAddress)
|
||||||
var banner string
|
var banner string
|
||||||
c.conn[0], banner, c.ExternalIP, err = tcp.ConnectToTCPServer(c.Options.RelayAddress, c.Options.RelayPassword, c.Options.SharedSecret)
|
c.conn[0], banner, c.ExternalIP, err = tcp.ConnectToTCPServer(c.Options.RelayAddress, c.Options.RelayPassword, c.Options.SharedSecret)
|
||||||
log.Debugf("banner: %s", banner)
|
log.Debugf("banner: %s", banner)
|
||||||
|
|
Loading…
Reference in New Issue